File tree 2 files changed +8
-1
lines changed
packages/astro/src/transitions
2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " astro " : patch
3
+ ---
4
+
5
+ Fixes an issue caused by trying to load text/partytown scripts during view transitions
Original file line number Diff line number Diff line change @@ -151,12 +151,14 @@ function runScripts() {
151
151
let wait = Promise . resolve ( ) ;
152
152
for ( const script of Array . from ( document . scripts ) ) {
153
153
if ( script . dataset . astroExec === '' ) continue ;
154
+ const type = script . getAttribute ( 'type' ) ;
155
+ if ( type && type !== 'module' && type !== 'text/javascript' ) continue ;
154
156
const newScript = document . createElement ( 'script' ) ;
155
157
newScript . innerHTML = script . innerHTML ;
156
158
for ( const attr of script . attributes ) {
157
159
if ( attr . name === 'src' ) {
158
160
const p = new Promise ( ( r ) => {
159
- newScript . onload = r ;
161
+ newScript . onload = newScript . onerror = r ;
160
162
} ) ;
161
163
wait = wait . then ( ( ) => p as any ) ;
162
164
}
You can’t perform that action at this time.
0 commit comments