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

Update islands example to Leptos v0.7 #271

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

NCura
Copy link
Contributor

@NCura NCura commented Jan 7, 2025

Hello!

Sorry for the delay in getting back to this, I was away. I noticed in issue #263 that the islands example was removed after the update to Leptos v0.7.

This pull request is an attempt to reintroduce the islands example. However, I'm encountering a recurring issue. The language can be changed via the header, and the URL updates accordingly, but the UI does not reflect the change dynamically. Manually reloading the page after changing the language causes the new language to display correctly. This appears to be the same issue we encountered previously.

Our solution was to reload programmatically using window().location().reload().unwrap() after the language change:

<input
    id=format!("language-{}-{}", name, lang.name)
    type="radio"
    name=format!("language-{}", name)
    value=lang
    checked=lang.is_active()
    on:click=move |_| {
        lang.activate();
        window()
            .location()
            .reload()
            .expect("Failed to reload the page");
    }
/>

But this time, it resets the URL parameter to the original language instead of preserving the change.

I’m considering whether we should shift away from using URL parameters for language selection and rely solely on cookies. I experimented with this approach, and the cookie updates correctly when the language changes. However, even with the cookie set to es, the page still loads with the en language.

Do you have any insights or suggestions to address these issues?

Thank you for your time and help!

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.

1 participant