fix: no deletion of scripts during view transition (#8636)
This commit is contained in:
parent
0352dec47b
commit
974d5117ab
2 changed files with 10 additions and 5 deletions
5
.changeset/short-cougars-worry.md
Normal file
5
.changeset/short-cougars-worry.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
'astro': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix: no deletion of scripts during view transition
|
|
@ -219,13 +219,13 @@ const { fallback = 'animate' } = Astro.props as Props;
|
||||||
for (const s2 of newDocument.scripts) {
|
for (const s2 of newDocument.scripts) {
|
||||||
if (
|
if (
|
||||||
// Inline
|
// Inline
|
||||||
(s1.textContent && s1.textContent === s2.textContent) ||
|
(!s1.src && s1.textContent === s2.textContent) ||
|
||||||
// External
|
// External
|
||||||
(s1.type === s2.type && s1.src === s2.src)
|
(s1.src && s1.type === s2.type && s1.src === s2.src)
|
||||||
) {
|
) {
|
||||||
s2.remove();
|
// the old script is in the new document: we mark it as executed to prevent re-execution
|
||||||
} else {
|
s2.dataset.astroExec = '';
|
||||||
s1.remove();
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue