-
Notifications
You must be signed in to change notification settings - Fork 62
Fix checklist node in client print #8126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix checklist node in client print #8126
Conversation
BacLuc
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we had a reason to not do this:
See in EndpointPerformanceTest
2025-09-06T12:37:42.9347400Z -/activities/item: 35\n
2025-09-06T12:37:42.9348030Z +/activities/item: 37\n
can't we solve this in the frontend?
something similar than this:
#7747
|
Yes, looks like it introduces an n+1 problem. I don't fully understand why in the case of the material node we do not have an n+1, maybe because there it is a one-to-many relation instead of the many-to-many relation between checklist nodes <-> checklist items...? Solving this in the frontend by preloading will result in n+1 API requests instead.. |
|
I tried several different ways to solve this, which turned out not to work:
So the only way I found that works is to provide |
Problem: I noticed that when reloading the print configurator page and then client printing a program with some activities with checklist nodes in it, the checklist nodes remain blank.
I then found out that inside client print some data is not properly preloaded before printing. Inside each checklist node, there is a _linked collection
checklistItems: { href: /api/checklist_items?checklistNodes=/api/content_node/checklist_nodes/1a2b3c4d }. Although all individual checklist items are present in the store, this filtered collection is missing. For material nodes and their attached material items, we don't have this problem.Detailed problem 1: In client print, we need this missing data to render the PDF correctly. This PR is an attempt to fix this problem, so that PDFs can be rendered complete with all content. I am doing this by embedding the checklist items in each checklist node, just like we already do with material items in material nodes.
Detailed problem 2: Currently, client print does not fail and report the error, but silently renders an empty Vue component, leaving an empty space in the PDF. This is due to Vue 3 aggressively catching errors which happen in
setupfunctions, and not escalating them to outside the Vue app by default. This will be tackled in a separate PR #8128, so we get all errors in client print in sentry.If we first solved detailed problem 2, then exporting pdfs would break. Therefore, I am first opening this PR and later a fix for detailed problem 2.