Open dkrat7 opened 3 hours ago
Hey @dkrat7, I'm here to help you with any bugs, questions, or contributions you have for Superset. Let's tackle this issue together!
The issue you're experiencing, where the Handlebars template reverts to its default state upon changing the dataset, is likely related to how the HandlebarsViewer
component handles state changes. The useMemo
hook in this component triggers a recompile of the template whenever the templateSource
or data
changes, which could lead to the template resetting if not managed properly [1].
To address this, you might need to ensure that the custom template state is preserved across dataset changes. This could involve modifying the logic that handles state updates to prevent overwriting the custom template with the default one. You may want to look into how the state is managed and updated when a dataset change occurs, possibly by implementing a mechanism to save and restore the custom template state.
To continue talking to Dosu, mention @dosu.
Bug description
When editing a Handlebars chart, if you modify the dataset and save, the Handlebars template will revert to its default state. If you are unaware of this behavior and save the chart, your custom template will be lost.
Screenshots/recordings
https://github.com/user-attachments/assets/c4236db8-9c85-48ef-80c4-83bb765f66e7
Superset version
master / latest-dev
Python version
I don't know
Node version
I don't know
Browser
Firefox
Additional context
This is not a new bug. I noticed it first in 4.0.0
Checklist