-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Server Islands with ClientRouter (astro:transitions) not interactive #12780
Comments
Hi @foosionsapps 👋🏼, thank you for opening this issue! In deed the example does not execute the component script after view transition when in DEV mode. When build for production everything seems to work fine, but you have to run the component script directly, without putting it into an |
Hi @martrapp thanks for your answer. I tried running the app in production and commented the |
Let me check again later. Did not work in Stackblitz for me so I ran it locally. |
Just tried again:
ran
What is different in your setup? |
Hi, I just tried locally and as you mentioned if I run the project in production works fine but not in dev using the node adapter: Navigating between pages using Dev: (locally) Prod: (locally)
Also I tried with vercel adapter and is not working in dev locally, I deployed to vercel to test in prod and it doesn't work either. Navigating between pages using Dev: (locally) Prod: (deployed on vercel)
I tested on Chrome 131 on Mac. |
Thank you for the detailed analysis, @foosionsapps! One question regarding Vercel in prod: When you write it is not working is it |
Using the Vercel adapter in prod the fallback is not replaced with the counter (server-island). |
The production failure on Vercel might be related to #12803. |
Yes, I'm getting the same error. |
The provided example does seem to work in dev. What am I missing? |
I'm not really sure if this is the same issue but I cannot get astro:page-load to seemingly have an effect. I am just trying to make a mobile navigation menu but it only executes if refreshing on the page instead of navigating to the page. <script>
const overviewButton = document.querySelector("[data-toggle-overview]");
const overviewPane = document.querySelector("[data-overview-pane]");
const links = document.querySelectorAll("[data-category-link]");
function initializeMenuToggle() {
overviewButton?.addEventListener("click", () => {
overviewPane?.classList.toggle("hidden");
});
links.forEach((link) =>
link.addEventListener("click", () => {
overviewPane?.classList.add("hidden");
})
);
}
document.addEventListener("astro:page-load", () => {
initializeMenuToggle();
}); // Works the same with or without page-load
</script> |
Hi @cabaucom376 👋🏼, no, your problem is completely unrelated to this issue ;-) You should use When you move those three const from the beginning of your script into the |
Thank you @martrapp, I have since realized that solution and fixed all issues on my desktop Chromium-based browser, but the script still doesn't function correctly on iOS Safari. I have had someone else report to me that they are having some script issues on the latest version of Astro, but I will do some digging when I am back from vacation and create a proper issue to not further clutter this one. |
Astro Info
If this issue only occurs in one browser, which browser is a problem?
All browsers
Describe the Bug
Using Server Islands and ClientRouter when I navigate to another page my component is not loading and also in cases that is loaded the component is not working.
What's the expected result?
After the Server Island component is loaded should be able to make it work interactive.
Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-spsbz89l
Participation
The text was updated successfully, but these errors were encountered: