pull/17124/head
Elliott Johnson 2 weeks ago
parent 998510cc06
commit d5e4af82a7

@ -19,7 +19,7 @@ You (or the framework you're using) called [`render(...)`](svelte-server#render)
> First set occurred at: > First set occurred at:
> %stack% > %stack%
This error occurs when using `hydratable` or `setHydratableValue` multiple times with the same key. To avoid this, you can combine `hydratable` with `cache`, or check whether the value has already been set with `hasHydratableValue`. This error occurs when using `hydratable` or `hydratable.set` multiple times with the same key. To avoid this, you can combine `hydratable` with `cache`, or check whether the value has already been set with `hydratable.has`.
```svelte ```svelte
<script> <script>

@ -21,6 +21,7 @@ function isomorphic_hydratable(key, fn, options) {
(val, has) => { (val, has) => {
if (!has) { if (!has) {
w.hydratable_missing_but_expected(key); w.hydratable_missing_but_expected(key);
return fn();
} }
return decode(val, options?.decode); return decode(val, options?.decode);
}, },
@ -45,7 +46,7 @@ export { hydratable };
*/ */
function get_hydratable_value(key, options = {}) { function get_hydratable_value(key, options = {}) {
if (!async_mode_flag) { if (!async_mode_flag) {
e.experimental_async_required('getHydratableValue'); e.experimental_async_required('hydratable.get');
} }
return access_hydratable_store( return access_hydratable_store(
@ -61,7 +62,7 @@ function get_hydratable_value(key, options = {}) {
*/ */
function has_hydratable_value(key) { function has_hydratable_value(key) {
if (!async_mode_flag) { if (!async_mode_flag) {
e.experimental_async_required('hasHydratableValue'); e.experimental_async_required('hydratable.set');
} }
return access_hydratable_store( return access_hydratable_store(
key, key,

@ -46,7 +46,7 @@ export { hydratable };
*/ */
function set_hydratable_value(key, value, options = {}) { function set_hydratable_value(key, value, options = {}) {
if (!async_mode_flag) { if (!async_mode_flag) {
e.experimental_async_required('setHydratableValue'); e.experimental_async_required('hydratable.set');
} }
const store = get_render_context(); const store = get_render_context();
@ -64,7 +64,7 @@ function set_hydratable_value(key, value, options = {}) {
*/ */
function has_hydratable_value(key) { function has_hydratable_value(key) {
if (!async_mode_flag) { if (!async_mode_flag) {
e.experimental_async_required('hasHydratableValue'); e.experimental_async_required('hydratable.has');
} }
const store = get_render_context(); const store = get_render_context();
return store.hydratables.has(key); return store.hydratables.has(key);

Loading…
Cancel
Save