Skip to content

Commit 6873685

Browse files
temp fix
1 parent 8179c6a commit 6873685

File tree

1 file changed

+6
-15
lines changed

1 file changed

+6
-15
lines changed

packages/svelte/src/internal/client/hydratable.js

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,11 @@ export function hydratable(key, fn, options = {}) {
1313
return fn();
1414
}
1515
var store = window.__svelte?.h;
16-
if (store === undefined) {
17-
throw new Error('TODO this should be impossible?');
18-
}
19-
const val = store.get(key);
16+
const val = store?.get(key);
2017
if (val === undefined) {
21-
throw new Error(
22-
`TODO Expected hydratable key "${key}" to exist during hydration, but it does not`
23-
);
18+
// TODO this should really be an error or at least a warning because it would be disastrous to expect
19+
// something to be synchronously hydratable and then have it not be
20+
return fn();
2421
}
2522
return parse(val, options.transport?.parse);
2623
}
@@ -38,10 +35,7 @@ export function get_hydratable_value(key, options = {}) {
3835
}
3936

4037
var store = window.__svelte?.h;
41-
if (store === undefined) {
42-
throw new Error('TODO this should be impossible?');
43-
}
44-
const val = store.get(key);
38+
const val = store?.get(key);
4539
if (val === undefined) {
4640
return undefined;
4741
}
@@ -58,10 +52,7 @@ export function has_hydratable_value(key) {
5852
return false;
5953
}
6054
var store = window.__svelte?.h;
61-
if (store === undefined) {
62-
throw new Error('TODO this should be impossible?');
63-
}
64-
return store.has(key);
55+
return store?.has(key) ?? false;
6556
}
6657

6758
/**

0 commit comments

Comments
 (0)