Module not working in Previewer mode

Good day, dear Retool forum.

I have the following problem.

My HTML2PDF module works perfectly in Edit mode. However, as soon as I switch to Preview mode, nothing works anymore.

When I click the button, the query is loaded. However, the PDF is not created and thus not available for download.

The query that is on the button and gets triggered is executed. Attached is the JSON. Maybe you can help me, that would be really great.

Suggestions for solutions are welcome.

PS, I got the module from the forum as well.

Hey @Kevin553
Can you share screenshot of your module ?
Check the code in edit mode after reset app state , check error in console

Thanks for your Help!
Here - there is no error:

I want to upload the json of the module but i cant... Retool please help!

This is not possible that there is no error comes in console, because any blockage comes in your code or data is not set perfectly that's why it's not show in preview mode after click on button.

In edit mode, first reset app state and then click on button without trigger query manually.


Yes i did it, see there is no error.
(Reset App State and then click button)

Can anybody help?

Hey @Kevin553! Welcome to the community forum. :slight_smile:

If you haven't already done so, can you try embedding the module in an app and then previewing the app? I would expect it to work just fine without having to embed but you never know.

It would also be super helpful to see your JSON for the purposes of debugging - feel free to send it to me via DM or, alternatively, give me your app name so that I can look it up on my end!

Hey Darren,

Thanks a lot for your response. Yes, I have already integrated the module into an app, but here is the JSON code again in the Google Drive link (I can't upload the JSON here). Could you please take a closer look at it?

Thank you!

Thanks for sharing, @Kevin553. This is actually super interesting! The short answer is that it works as expected when leaving the customHTMLPDF iframe visible.

Screenshot 2024-08-06 at 9.42.30 AM

It's more difficult to figure out exactly why that is the case, though. :thinking: One observation is that toggling the "Hidden" attribute actually wraps the iframe in an InvisibleWidgetWrapper component.

Screenshot 2024-08-06 at 9.38.10 AM

Another thing that is super odd is that, even when the iframe is hidden, I can get everything to function correctly by manually inspecting its contents via the browser's dev tools.

In conclusion, I'm guessing that hidden components are being treated differently (maybe lazily loaded?) when wrapped in the InvisibleWidgetWrapper component. I'll reach out to our internal teams to see if this is intended behavior and provide an update here when I can. In the meantime, does it work for you to leave the iframe visible? You should still be able to give it a height of 0px via custom CSS in order to effectively hide it while allowing your script to still run correctly.

NOW it Work! THank you sooo much!

1 Like