You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The page uses an action to push formdata, what's relevant is the actual usage of the "actions.addRecipe" action. The page also contains a template for a block that is outside the layout block.
to inside <Layout></Layout>. I don't understand why this works. <IngredientsBlock /> has two calls, one inside layout, another in this template block, but when it's called even once outside the layout here the inline script fails to load correctly.
I don't have an example for workaround 3, but it is enabling is:inline on the IngredientsBlock like so:
My assumption is that this is a bug, I don't understand how exactly any of the two workarounds are related but each resolves the issue and the console.log message gets logged as expected.
Astro Info
If this issue only occurs in one browser, which browser is a problem?
Chrome, Firefox, Vivaldi
Describe the Bug
The behaviour is weird because there are two totally different workarounds around the issue.
Essentially assume a layout:
Then a simple page using the layout:
The page uses an action to push formdata, what's relevant is the actual usage of the "actions.addRecipe" action. The page also contains a template for a block that is outside the layout block.
The IngredientsBlock is a super simple component:
The issue is:
Welcome, browser console!
never logs to console.Reproducible example: https://github.com/Levelleor/astro-script-not-loading
Workarounds:
Omit
const { error } = await actions.addRecipe(formData);
from the script on the page component.Move
to inside
<Layout></Layout>
. I don't understand why this works.<IngredientsBlock />
has two calls, one inside layout, another in this template block, but when it's called even once outside the layout here the inline script fails to load correctly.is:inline
on the IngredientsBlock like so:I'd assume the script should be inline by default, it's just a console.log call and according to https://docs.astro.build/en/guides/client-side-scripts/#script-processing I see no reason for it to not work without
is:inline
.My assumption is that this is a bug, I don't understand how exactly any of the two workarounds are related but each resolves the issue and the console.log message gets logged as expected.
What's the expected result?
Welcome, browser console!
logs to console.Link to Minimal Reproducible Example
https://github.com/Levelleor/astro-script-not-loading
Participation
The text was updated successfully, but these errors were encountered: