Skip to content

Commit 28acd1f

Browse files
committed
restore app-level hydrate option
1 parent bbfc17d commit 28acd1f

File tree

6 files changed

+10
-13
lines changed

6 files changed

+10
-13
lines changed

documentation/docs/14-configuration.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ const config = {
3131
protocol: null
3232
},
3333
host: null,
34+
hydrate: true,
3435
inlineStyleThreshold: 0,
3536
methodOverride: {
3637
parameter: '_method',

packages/kit/src/core/build/build_server.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ export class App {
6868
error.stack = this.options.get_stack(error);
6969
},
7070
hooks,
71+
hydrate: ${s(config.kit.hydrate)},
7172
manifest,
7273
method_override: ${s(config.kit.methodOverride)},
7374
paths: { base, assets },

packages/kit/src/core/config/index.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ test('fills in defaults', () => {
3434
protocol: null
3535
},
3636
host: null,
37-
hydrate: null,
37+
hydrate: true,
3838
inlineStyleThreshold: 0,
3939
methodOverride: {
4040
parameter: '_method',
@@ -146,7 +146,7 @@ test('fills in partial blanks', () => {
146146
protocol: null
147147
},
148148
host: null,
149-
hydrate: null,
149+
hydrate: true,
150150
inlineStyleThreshold: 0,
151151
methodOverride: {
152152
parameter: '_method',

packages/kit/src/core/config/options.js

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,7 @@ const options = object(
7373

7474
host: string(null),
7575

76-
// TODO remove this for 1.0
77-
hydrate: validate(null, (input) => {
78-
if (input !== undefined) {
79-
throw new Error(
80-
'config.kit.hydrate has been removed — use the handle hook instead: https://kit.svelte.dev/docs#hooks-handle'
81-
);
82-
}
83-
}),
76+
hydrate: boolean(true),
8477

8578
inlineStyleThreshold: number(0),
8679

packages/kit/src/core/config/test/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ test('load default config (esm)', async () => {
3636
protocol: null
3737
},
3838
host: null,
39-
hydrate: null,
39+
hydrate: true,
4040
inlineStyleThreshold: 0,
4141
methodOverride: {
4242
parameter: '_method',

packages/kit/src/runtime/server/index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export async function respond(incoming, options, state = {}) {
8383
print_error('query', 'searchParams');
8484

8585
const resolve_opts = {
86-
hydrate: true,
86+
hydrate: options.hydrate,
8787
router: true,
8888
ssr: true
8989
};
@@ -92,7 +92,9 @@ export async function respond(incoming, options, state = {}) {
9292
return await options.hooks.handle({
9393
request,
9494
resolve: async (request, opts) => {
95-
if (opts && 'hydrate' in opts) resolve_opts.hydrate = /** @type {boolean} */ (opts.hydrate);
95+
if (resolve_opts.hydrate && opts && 'hydrate' in opts) {
96+
resolve_opts.hydrate = /** @type {boolean} */ (opts.hydrate);
97+
}
9698
if (opts && 'router' in opts) resolve_opts.router = /** @type {boolean} */ (opts.router);
9799
if (opts && 'ssr' in opts) resolve_opts.ssr = /** @type {boolean} */ (opts.ssr);
98100

0 commit comments

Comments
 (0)