File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -24,6 +24,9 @@ const INTERNAL_PATHS = {
2424}
2525
2626
27+ const isSafari = self . navigator . userAgent . toLowerCase ( ) . includes ( 'safari' ) ;
28+
29+
2730// key : value
2831// live view client ID: codeit client ID
2932let liveViewClients = { } ;
@@ -210,7 +213,7 @@ function handleFetchRequest(request, event) {
210213
211214 const liveFramePath = INTERNAL_PATHS . relLivePath ;
212215
213- const liveViewClientId = event . resultingClientId ?? event . targetClientId ;
216+ let liveViewClientId = event . resultingClientId ?? event . targetClientId ;
214217
215218 // if codeit client is creating a new live view
216219 if ( url . endsWith ( liveFramePath )
@@ -221,6 +224,18 @@ function handleFetchRequest(request, event) {
221224 parentClientId = parentClientId . slice ( 0 , - 1 ) ;
222225 clientId = parentClientId ;
223226
227+ // if on safari
228+ if ( isSafari && event . targetClientId ) {
229+
230+ // add 1 to live view client id
231+ let splitId = liveViewClientId . split ( '-' ) ;
232+
233+ splitId [ 1 ] = Number ( splitId [ 1 ] ) + 1 ;
234+
235+ liveViewClientId = splitId . join ( '-' ) ;
236+
237+ }
238+
224239 // pair live view client ID
225240 // with codeit client ID
226241 // in client array
You can’t perform that action at this time.
0 commit comments