Skip to content

Commit 6c61ddf

Browse files
committed
BREAKING noPreserveState don't preserve internal state of props either anymore
1 parent 458364e commit 6c61ddf

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

runtime/svelte-hooks.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,17 @@ export const createProxiedComponent = (
103103
const isCurrent = _cmp => cmp === _cmp
104104

105105
const assignOptions = (target, anchor, restore, noPreserveState) => {
106-
const $$inject = noPreserveState
107-
? extractProps(restore.state, compileData)
108-
: restore.state
106+
// NOTE 2020-06-30 with noPreserveState, don't restore internal state of
107+
// props either, reset them to the values set by the parent component or
108+
// defaults
109+
//
110+
// TODO this makes compileData not needed anymore, so we should probably
111+
// drop the weight now
112+
//
113+
// const $$inject = noPreserveState
114+
// ? extractProps(restore.state, compileData)
115+
// : restore.state
116+
const $$inject = noPreserveState ? {} : restore.state
109117
const props = Object.assign({}, options.props)
110118
if ($$inject) {
111119
props.$$inject = $$inject

0 commit comments

Comments
 (0)