Is your feature request related to a problem? Please describe
When users reset story args via the handle in Controls, the args are simply reverted back to initial args, and a regular call to renderToCanvas is done. However some renderers, like Svelte, behave badly when args are changed to undefined, and they would benefit from knowing if the re-render is happening because of an args reset, so it can fully remount the component instead. Currently the Svelte renderer has implemented a workaround for this in #21659.
Describe the solution you'd like
Similar to the forceRemount argument we pass to renderToCanvas, we could pass on a isStoryArgsReset argument as well.
Describe alternatives you've considered
As considered in #21470 (comment):
In the broader perspective I'm wondering if reseting args should just be always be a force remount, in all renderers. I'm not sure what the case is for "what happens if my component gets props reset to defaults but still maintains state" in any renderer, irregardless of it being possible or not. Except it would be slightly more performant to not remount the whole tree.
An alternative solution here could be that the RESET_STORY_ARGS event causes a forceRemount instead, if we think that should be the case for all renderers.
Are you able to assist to bring the feature to reality?
yes, I can
Additional context
Original issue for Svelte: #21470
PR with workaround: #21659
Is your feature request related to a problem? Please describe
When users reset story args via the handle in Controls, the args are simply reverted back to initial args, and a regular call to
renderToCanvasis done. However some renderers, like Svelte, behave badly when args are changed toundefined, and they would benefit from knowing if the re-render is happening because of an args reset, so it can fully remount the component instead. Currently the Svelte renderer has implemented a workaround for this in #21659.Describe the solution you'd like
Similar to the
forceRemountargument we pass torenderToCanvas, we could pass on aisStoryArgsResetargument as well.Describe alternatives you've considered
As considered in #21470 (comment):
An alternative solution here could be that the
RESET_STORY_ARGSevent causes aforceRemountinstead, if we think that should be the case for all renderers.Are you able to assist to bring the feature to reality?
yes, I can
Additional context
Original issue for Svelte: #21470
PR with workaround: #21659