Skip to content
Source
Sign inSign up
TanStack/router

fix(router-ssr-query-core): drop the query stream reader instead of releasing it #8796

OpenEmilEinarsen(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/8796/headopened

Showing 3 changed files with 17 additions and 11 deletions.

x
0 of 3 viewed, 3 left
5 additions and 0 deletions.changeset/webkit-reader-release-lock.mdAdded
View file
@@ -0,0 +1,5 @@
+---
+'@tanstack/router-ssr-query-core': patch
+---
+​
+Drop the hydration stream reader instead of calling `releaseLock()`, which can deadlock WebKit's garbage collector and freeze the page.
2 additions and 2 deletionspackages/router-ssr-query-core/src/index.tsModified
View file
@@ -241,6 +241,8 @@
throw error
​
+ // The reader is dropped, not released, once the stream ends. WebKit's
+ // releaseLock() can deadlock with a garbage collection and freeze the page.
const reader = query.stream.getReader()
void (async () => {
try {
@@ -254,8 +256,6 @@
} catch (error) {
console.error('Error reading query stream:', error)
void reader.cancel(error).catch(() => {})
- } finally {
- reader.releaseLock()
})()
10 additions and 9 deletionspackages/router-ssr-query-core/tests/index.test.tsModified
View file