File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed
src/packages/frontend/client Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -683,3 +683,31 @@ const touchComputeServer = throttle(
683
683
} ,
684
684
30000 ,
685
685
) ;
686
+
687
+ // Polyfill for Safari: Add async iterator support to ReadableStream if missing.
688
+ // E.g., this is missing in all versions of Safari as of May 2025 according to
689
+ // https://caniuse.com/?search=ReadableStream%20async
690
+ // This breaks reading and writing files to projects, which is why this
691
+ // is here (e.g., the writeFile and readFile functions above).
692
+ // This might also matter for Jupyter.
693
+ // https://chatgpt.com/share/6827a476-dbe8-800e-9156-3326eb41baae
694
+ if (
695
+ typeof ReadableStream !== "undefined" &&
696
+ ! ReadableStream . prototype [ Symbol . asyncIterator ]
697
+ ) {
698
+ ReadableStream . prototype [ Symbol . asyncIterator ] = function ( ) {
699
+ const reader = this . getReader ( ) ;
700
+ return {
701
+ async next ( ) {
702
+ return reader . read ( ) ;
703
+ } ,
704
+ async return ( ) {
705
+ reader . releaseLock ( ) ;
706
+ return { done : true } ;
707
+ } ,
708
+ [ Symbol . asyncIterator ] ( ) {
709
+ return this ;
710
+ } ,
711
+ } ;
712
+ } ;
713
+ }
You can’t perform that action at this time.
0 commit comments