pull/17124/head
Elliott Johnson 3 weeks ago
parent 8179c6a643
commit 6873685b2f

@ -13,14 +13,11 @@ export function hydratable(key, fn, options = {}) {
return fn(); return fn();
} }
var store = window.__svelte?.h; var store = window.__svelte?.h;
if (store === undefined) { const val = store?.get(key);
throw new Error('TODO this should be impossible?');
}
const val = store.get(key);
if (val === undefined) { if (val === undefined) {
throw new Error( // TODO this should really be an error or at least a warning because it would be disastrous to expect
`TODO Expected hydratable key "${key}" to exist during hydration, but it does not` // something to be synchronously hydratable and then have it not be
); return fn();
} }
return parse(val, options.transport?.parse); return parse(val, options.transport?.parse);
} }
@ -38,10 +35,7 @@ export function get_hydratable_value(key, options = {}) {
} }
var store = window.__svelte?.h; var store = window.__svelte?.h;
if (store === undefined) { const val = store?.get(key);
throw new Error('TODO this should be impossible?');
}
const val = store.get(key);
if (val === undefined) { if (val === undefined) {
return undefined; return undefined;
} }
@ -58,10 +52,7 @@ export function has_hydratable_value(key) {
return false; return false;
} }
var store = window.__svelte?.h; var store = window.__svelte?.h;
if (store === undefined) { return store?.has(key) ?? false;
throw new Error('TODO this should be impossible?');
}
return store.has(key);
} }
/** /**

Loading…
Cancel
Save