Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: modal-theme-update-on-state-change #1676

Conversation

ChefBingbong
Copy link

@ChefBingbong ChefBingbong commented Feb 18, 2024

Bug fix for the issue from widget v0.2.0 and up where the widgets state wont update when the config changes on theme change or env change.

I believe the migration to vite caused the bug as ever since the migration, the trick of passing a key to the react widget as the strinified config stopped working and caused the widget to not mount on change in the config

solution is just to manage some the worm-hole apps config as state variables instad of just inline exports such as most of the config is.

the widgets config really would only change either when the theme is changed or the env is changed. all other params either depend on these, or woill likely not change. so for now i extended the theme config and the env/netowrk config items to a context at the top of the app

updating the widget externally seems to never work by conventional means in terms of trying to cause internal rerenders when the config changes. im not sure why exactly this is spent a while trying many ways. i think maybe its because the config is initialised in-line and non stateful and el the selector that gets the wormhole-connect is too. so i wonder does the config just nevr change because the worm-hole div selector never changes. it initialized once in current implementation and never updates as config changes.

so thinking this i add the config initialuzation and this selector init to a useeffect and create a custom event trigger to update the config when triggered. every is fixed now the widget now updates on config change

Copy link

netlify bot commented Feb 18, 2024

👷 Deploy request for wormhole-connect pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit d3c6c67

Copy link

netlify bot commented Feb 18, 2024

‼️ Deploy request for wormhole-connect-mainnet rejected.

Name Link
🔨 Latest commit d3c6c67

Copy link

netlify bot commented Feb 18, 2024

👷 Deploy request for wormhole-connect-builder pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit d3c6c67

@artursapek artursapek self-requested a review February 21, 2024 15:05
@artursapek
Copy link
Collaborator

thanks for the PR! I'm addressing this in #1698 by allowing the theme to be updated via a normal React prop. going to close this one.

@artursapek artursapek closed this Feb 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants