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

Make banner work when re-loaded #10

Merged
merged 1 commit into from
May 29, 2024

Conversation

ibobo
Copy link
Contributor

@ibobo ibobo commented May 21, 2024

My project use next-intl for internationalization, and I had to move my layout.tsx inside a [locale] folder. This is fine in most situation, but when navigating between languages, some cookie dependent features stopped working.

When the current locale is changed, since che layout is inside the [locale] folder, all providers are unmounted and mounted again and it turns out that when this is done to the IubendaProvider it doesn't work anymore since it loses its internal state.

This PR fixes this issue by checking if the Iubenda scripts are already loaded when the provider is mounted, updating then its internal state with data from the _iub object without waiting for the callback, which isn't called at all in this situation.

@liarco
Copy link
Member

liarco commented May 23, 2024

Hi @ibobo,
thank you for your valuable feedback and for this PR. Will make sure to review this as soon as possible and also to include it into a new release if doesn't introduce any breaking changes.

@ivanbalmita let's talk about this later today to check if we can speed this up in any ways. Thx.

@liarco liarco merged commit 4e0d079 into mep-agency:main May 29, 2024
1 check passed
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