Issue: Image not updated on re-render

Stimulsoft Reports.JS discussion
lega
Posts: 10
Joined: Mon May 29, 2017 12:44 pm

Issue: Image not updated on re-render

Post by lega »

If report contains two images, bound using dataURL, the second one(maybe even all, not tested this) is cached somewhere in report global code. If then another instance of same report is rendered in same browser session, the newly rendered report will contain old image.

Our real word scenario, we have ability for user to see and sign an order report on-screen. We should re-render it after it's signed (or re-signed). Due to this bug the first rendered signature image is cached forever, even if opened with another order data.

The attached archive contains designer and viewer for the issue. Just hit render multiple times. For sake of this example unique image is generated using canvas and counter.
Each canvas is left in document for debug purposes, this shows that image rendered on report is not same as image provided via report data.

There is also a repro without issue, when the first (in this case static) image is removed from report definition, the second image is updated fine on every re-render.

Hope it will help to fix the issue. Thanks!
Attachments
cached-image-repro.zip
Repro
(2.09 MiB) Downloaded 206 times
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Issue: Image not updated on re-render

Post by Alex K. »

Hello,

Please try to use the async methods for rendering and exporting:

Code: Select all

var report = new Stimulsoft.Report.StiReport();
report.loadFile("reports/test.mrt");
report.render();
var settings = new Stimulsoft.Report.Export.StiPdfExportSettings();
// Create an PDF service instance.             
var service = new Stimulsoft.Report.Export.StiPdfExportService();
// Create a MemoryStream object.             
var stream = new Stimulsoft.System.IO.MemoryStream();
// Export PDF using MemoryStream.             
service.exportToAsync(function () {                 
    var data = stream.toArray();                 
    // Get report file name                 
    var fileName = String.isNullOrEmpty(report.reportAlias) ? report.reportName : report.reportAlias;         
    // Save data to file                 
    Object.saveAs(data, fileName + ".pdf", "application/pdf");
}, report, stream, settings);
Thank you.
lega
Posts: 10
Joined: Mon May 29, 2017 12:44 pm

Re: Issue: Image not updated on re-render

Post by lega »

Hi Aleksey, thanks for the reply.

Still no luck. I'm getting the same results with async. Here is my rendering code:

Code: Select all

function renderViaAsyncExport(report) {
	var settings = new Stimulsoft.Report.Export.StiHtmlExportSettings();			
	var service = new Stimulsoft.Report.Export.StiHtmlExportService();
	var textWriter = new Stimulsoft.System.IO.TextWriter();
	var htmlTextWriter = new Stimulsoft.Report.Export.StiHtmlTextWriter(textWriter);

	report.render();    
	service.exportToAsync(function () {  
		var html = textWriter.getStringBuilder().toString();
		document.getElementById("viewer-content").innerHTML = html;
	}, report, htmlTextWriter, settings);
}
Repro attached, see no-issue_viewer.html.
Attachments
repro.zip
(2.13 MiB) Downloaded 205 times
Last edited by lega on Mon Jun 26, 2017 12:27 pm, edited 1 time in total.
lega
Posts: 10
Joined: Mon May 29, 2017 12:44 pm

Re: Issue: Image not updated on re-render

Post by lega »

Just thinking now ... I'm not sure how doing async would have helped in the first place. Only if async methods were more maintained than the sync ones. Which would be weird, wouldn't it?
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Issue: Image not updated on re-render

Post by Alex K. »

Hello,

Sorry for the delay with response.

We need some additional time to investigate the issue.

Thank you.
lega
Posts: 10
Joined: Mon May 29, 2017 12:44 pm

Re: Issue: Image not updated on re-render

Post by lega »

Hi Aleksey, sure, take your time. Hope it will get fixed soon.

Thanks for the response.
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Issue: Image not updated on re-render

Post by Alex K. »

Hello,

Thank you for the detailed information.
We have found some bugs. We will try to fix it fast as possible.

Thank you.
lega
Posts: 10
Joined: Mon May 29, 2017 12:44 pm

Re: Issue: Image not updated on re-render

Post by lega »

Hi guys,

It's been almost 6 months. We recently tried with the new (2018.1) version, but sadly the issue still exists. Attached is simplified reproduction of the issue.
Can someone take another look please?

To use it, just run

Code: Select all

node server.js
And navigate to http://127.0.0.1:8125

The reproduction is as isolated and minimal as possible.

Thanks
Attachments
image-not-updated-repro.zip
(1.3 MiB) Downloaded 615 times
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Issue: Image not updated on re-render

Post by HighAley »

Hello.

We are very sorry for such delay with answer.
We have reproduced the issue and can't find where is comes from.
We will look at this issue more deeper and will let you know about results.

Thank you.

Ticket reference: #4505
Vadim
Posts: 362
Joined: Tue Apr 23, 2013 11:23 am

Re: Issue: Image not updated on re-render

Post by Vadim »

Hello.
It will be fixed from next version (2018.1.9).
Plase clear cache before rendering

Code: Select all

...
Stimulsoft.Report.StiFileImageCache.clear();
report.render();
Post Reply