Bug on Ersri PrintTask

Discussion created by tomlai92 on Jul 12, 2018

Hi everyone,

I am currently looking into using Esri Print Widget and print out Maps with Legends.

We have multiple layers what can be toggled visibility on or off and toggling new visibility of new layer is where the issue comes from. The first time we inject PrintTask and do execute, it does print map with correct legends. Everything looks good ! 

After enabling new layer visibility, the legend does not get updating after printing. Looking into the code, it seems like this._legendLayers in PrintTask.js contains duplicate operational layers as it does not get emptied our when we perform printTask.execute() so it only gets the previous operational layers for the legend options.

I want to know if anyone comes across this issue and what is the fix for this?

Thank you