Closed dfiorentin closed 5 years ago
thanks for the description. actually my comment on the forum was asking if you can put your project in a github repository so we can test the same thing that you have on your local too. but i guess it is fine, because we have the entities in the playground and also your package.json and your config, so i guess we can replicate with just that.
we will give a look and see if we can replicate the bug. thanks
I'm sorry, I just created the repository, I hope it helps! https://github.com/dfiorentin/pdfutils_merging_problem Thank you.
excellent, thank you for that. now it will much easier to replicate. let's see..
Any news?
@dfiorentin yes, i'm looking into the problem right now, i have confirmed that the bug exists, but i'm still investigating the source of the problem..
Perfect, thank you.
i solved this bug, and the fix will be part of the next jsreport release.
if you want to try the fix, you would need to update a lot of extensions (because the bug was present in a package that was common dependency of other extensions)
you would need to do the following:
execute npm i jsreport/jsreport-authorization jsreport/jsreport-child-templates jsreport/jsreport-fs-store jsreport/jsreport-reports jsreport/jsreport-templates jsreport/jsreport-version-control jsreport/jsreport-chrome-pdf jsreport/jsreport-core
after the install you should delete the directory node_modules/jsreport/node_modules/jsreport-core
, i do this using rimraf node_modules/jsreport/node_modules/jsreport-core
thanks for the bug report.
The problem is the following: I need a way to add/remove some reports dynamically using pdf-utils, based on some computation on data (chrome recipe). For example, if in datas that came from an application there's a particular option, i need to add a report on prepend/append.
I've tried a solution involving a script on beforeRenderer, that change req.template.pdfOperations based on data:
I've try to replicate on the playground (run the template merging test) https://playground.jsreport.net/w/dfiorentin/KuHWJU0z and it works correctly here. However, if I use the same on my configuration, the utils has been overwritten.
The first time you run the report, everything works as expected. In the following ones, however, it seems that it has memory of previous executions, producing unexpected results. If I refresh the page, I notice that the report now has in its parameters in the pdf-utils section the reports added through the script.(initially it has nothing).
In fact, If I run it locally in debug mode, I notice that req.template.pdfOperations is not empty.
Another strange fact is related to the order in which I go to add reports to the pdf utils: if in the first execution I only add one report and in the second I add 2, it works correctly. If in the first execution I add 2 reports and in the next one I represent only one, it renders that report twice. It almost seems that several reports can be added in append/merge, but I can't remove them.
My package list is the following:
So this should be the last jsreportversion (i've done another npm install again just now).
About my jsreport configuration, I've tried to remove all of template's options in search of the problem, but I still have the issue, even with the following configuration:
Some new information that could help: we save report in fileSystem and not in DB, can be related to this the problem? Another thing: I noticed that if I run the report, reload the page and reopen the template, the report has the parameters of the util modified. If I turn off and on jsreport again, the configuration of the template returns to the original one. Is there any caching system that creates conflict?
We will run jsreport either in local or in a docker installation.
Thank you.