dedupe-stack-stuff
Elliott Johnson 8 months ago
parent b5f21430ba
commit 3c36c7e4e8

@ -17,7 +17,7 @@ The `html` property of server render results has been deprecated. Use `body` ins
### hydratable_clobbering
```
Attempted to set hydratable with key `%key%` twice with different values.
Attempted to set `hydratable` with key `%key%` twice with different values.
First instance occurred at:
%stack%
@ -44,7 +44,7 @@ This error occurs when using `hydratable` multiple times with the same key. To a
### hydratable_serialization_failed
```
Failed to serialize `hydratable` data.
Failed to serialize `hydratable` data for key `%key%`.
`hydratable` can serialize anything [`uneval` from `devalue`](https://npmjs.com/package/uneval) can, plus Promises.

@ -10,7 +10,7 @@ You (or the framework you're using) called [`render(...)`](svelte-server#render)
## hydratable_clobbering
> Attempted to set hydratable with key `%key%` twice with different values.
> Attempted to set `hydratable` with key `%key%` twice with different values.
>
> First instance occurred at:
> %stack%
@ -35,7 +35,7 @@ This error occurs when using `hydratable` multiple times with the same key. To a
## hydratable_serialization_failed
> Failed to serialize `hydratable` data.
> Failed to serialize `hydratable` data for key `%key%`.
>
> `hydratable` can serialize anything [`uneval` from `devalue`](https://npmjs.com/package/uneval) can, plus Promises.
>

@ -27,7 +27,7 @@ export function html_deprecated() {
}
/**
* Attempted to set hydratable with key `%key%` twice with different values.
* Attempted to set `hydratable` with key `%key%` twice with different values.
*
* First instance occurred at:
* %stack%
@ -40,7 +40,7 @@ export function html_deprecated() {
* @returns {never}
*/
export function hydratable_clobbering(key, stack, stack2) {
const error = new Error(`hydratable_clobbering\nAttempted to set hydratable with key \`${key}\` twice with different values.
const error = new Error(`hydratable_clobbering\nAttempted to set \`hydratable\` with key \`${key}\` twice with different values.
First instance occurred at:
${stack}
@ -54,17 +54,18 @@ ${stack2}\nhttps://svelte.dev/e/hydratable_clobbering`);
}
/**
* Failed to serialize `hydratable` data.
* Failed to serialize `hydratable` data for key `%key%`.
*
* `hydratable` can serialize anything [`uneval` from `devalue`](https://npmjs.com/package/uneval) can, plus Promises.
*
* Stack:
* %stack%
* @param {string} key
* @param {string} stack
* @returns {never}
*/
export function hydratable_serialization_failed(stack) {
const error = new Error(`hydratable_serialization_failed\nFailed to serialize \`hydratable\` data.
export function hydratable_serialization_failed(key, stack) {
const error = new Error(`hydratable_serialization_failed\nFailed to serialize \`hydratable\` data for key \`${key}\`.
\`hydratable\` can serialize anything [\`uneval\` from \`devalue\`](https://npmjs.com/package/uneval) can, plus Promises.

@ -69,7 +69,10 @@ function encode(key, value, values, unresolved) {
const serialize_promise = value
.then(scoped_uneval)
.catch((devalue_error) =>
e.hydratable_serialization_failed(serialization_stack(entry.stack, devalue_error?.stack))
e.hydratable_serialization_failed(
key,
serialization_stack(entry.stack, devalue_error?.stack)
)
);
serialize_promise.catch(() => {});
unresolved?.set(serialize_promise, key);

Loading…
Cancel
Save