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

Injected scripts not injected to injected routes #7203

Closed
1 task
delucis opened this issue May 25, 2023 · 1 comment · Fixed by #7262
Closed
1 task

Injected scripts not injected to injected routes #7203

delucis opened this issue May 25, 2023 · 1 comment · Fixed by #7262
Labels
- P3: minor bug An edge case that only affects very specific usage (priority)

Comments

@delucis
Copy link
Member

delucis commented May 25, 2023

What version of astro are you using?

2.5.0

Are you using an SSR adapter? If so, which one?

n/a

What package manager are you using?

npm/pnpm

What operating system are you using?

macOS / Stackblitz

What browser are you using?

Firefox

Describe the Bug

Routes injected using the injectRoute integration API do not get scripts injected via the injectScript API added to them.

I’ve tested injectScript('page', '...') and injectScript('page-ssr', '...') and both are not loaded on injected routes.

The reproduction shows the same route (src/route.astro) loaded at / (via src/pages/index.astro) and at /injected (via the injectRoute API).

At /:

  • Tailwind styles work (the Tailwind integration uses injectScript('page-ssr', '...') to inject them)
  • An alert() injected into the page also pops up.

At /injected neither of these work.

Uncovered this here when someone tried adding the Tailwind integration to Starlight: withastro/starlight#88

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-ssvscu?file=astro.config.mjs

Participation

  • I am willing to submit a pull request for this issue.
@bluwy bluwy added the - P3: minor bug An edge case that only affects very specific usage (priority) label May 25, 2023
@andremralves
Copy link
Contributor

I found what is causing this issue. I'm working on a solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P3: minor bug An edge case that only affects very specific usage (priority)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants