diff --git a/src/generators/dom/index.ts b/src/generators/dom/index.ts
index 8e0ec3404c..7c7c4a45dc 100644
--- a/src/generators/dom/index.ts
+++ b/src/generators/dom/index.ts
@@ -190,9 +190,7 @@ export default function dom(
`if (!options || (!options.target && !options._root)) throw new Error("'target' is a required option");`}
@init(this, options);
${generator.usesRefs && `this.refs = {};`}
- this._state = ${templateProperties.data
- ? `@assign(%data(), options.data)`
- : `options.data || {}`};
+ this._state = @assign(${templateProperties.data ? '%data()' : '{}'}, options.data);
${generator.metaBindings}
${computations.length && `this._recompute({ ${Array.from(computationDeps).map(dep => `${dep}: 1`).join(', ')} }, this._state);`}
${options.dev &&
diff --git a/test/js/samples/component-static/expected-bundle.js b/test/js/samples/component-static/expected-bundle.js
index 12c0a0cd4b..d26e5c6c95 100644
--- a/test/js/samples/component-static/expected-bundle.js
+++ b/test/js/samples/component-static/expected-bundle.js
@@ -198,7 +198,7 @@ function create_main_fragment(state, component) {
function SvelteComponent(options) {
init(this, options);
- this._state = options.data || {};
+ this._state = assign({}, options.data);
if (!options._root) {
this._oncreate = [];
diff --git a/test/js/samples/component-static/expected.js b/test/js/samples/component-static/expected.js
index 039ef606ed..421a7adda6 100644
--- a/test/js/samples/component-static/expected.js
+++ b/test/js/samples/component-static/expected.js
@@ -33,7 +33,7 @@ function create_main_fragment(state, component) {
function SvelteComponent(options) {
init(this, options);
- this._state = options.data || {};
+ this._state = assign({}, options.data);
if (!options._root) {
this._oncreate = [];
diff --git a/test/js/samples/computed-collapsed-if/expected-bundle.js b/test/js/samples/computed-collapsed-if/expected-bundle.js
index 41c35ea754..d2d76eb003 100644
--- a/test/js/samples/computed-collapsed-if/expected-bundle.js
+++ b/test/js/samples/computed-collapsed-if/expected-bundle.js
@@ -191,7 +191,7 @@ function create_main_fragment(state, component) {
function SvelteComponent(options) {
init(this, options);
- this._state = options.data || {};
+ this._state = assign({}, options.data);
this._recompute({ x: 1 }, this._state);
this._fragment = create_main_fragment(this._state, this);
diff --git a/test/js/samples/computed-collapsed-if/expected.js b/test/js/samples/computed-collapsed-if/expected.js
index bc3fcc37d5..c2f5e3c2be 100644
--- a/test/js/samples/computed-collapsed-if/expected.js
+++ b/test/js/samples/computed-collapsed-if/expected.js
@@ -26,7 +26,7 @@ function create_main_fragment(state, component) {
function SvelteComponent(options) {
init(this, options);
- this._state = options.data || {};
+ this._state = assign({}, options.data);
this._recompute({ x: 1 }, this._state);
this._fragment = create_main_fragment(this._state, this);
diff --git a/test/js/samples/css-media-query/expected-bundle.js b/test/js/samples/css-media-query/expected-bundle.js
index 862f721ebc..95fad711ca 100644
--- a/test/js/samples/css-media-query/expected-bundle.js
+++ b/test/js/samples/css-media-query/expected-bundle.js
@@ -226,7 +226,7 @@ function create_main_fragment(state, component) {
function SvelteComponent(options) {
init(this, options);
- this._state = options.data || {};
+ this._state = assign({}, options.data);
if (!document.getElementById("svelte-2363328337-style")) add_css();
diff --git a/test/js/samples/css-media-query/expected.js b/test/js/samples/css-media-query/expected.js
index 5b77893900..3c36f9c6ce 100644
--- a/test/js/samples/css-media-query/expected.js
+++ b/test/js/samples/css-media-query/expected.js
@@ -41,7 +41,7 @@ function create_main_fragment(state, component) {
function SvelteComponent(options) {
init(this, options);
- this._state = options.data || {};
+ this._state = assign({}, options.data);
if (!document.getElementById("svelte-2363328337-style")) add_css();
diff --git a/test/js/samples/css-shadow-dom-keyframes/expected-bundle.js b/test/js/samples/css-shadow-dom-keyframes/expected-bundle.js
index 4c8fad71f7..cbcd06b93b 100644
--- a/test/js/samples/css-shadow-dom-keyframes/expected-bundle.js
+++ b/test/js/samples/css-shadow-dom-keyframes/expected-bundle.js
@@ -205,7 +205,7 @@ class SvelteComponent extends HTMLElement {
constructor(options = {}) {
super();
init(this, options);
- this._state = options.data || {};
+ this._state = assign({}, options.data);
this.attachShadow({ mode: 'open' });
this.shadowRoot.innerHTML = ``;
diff --git a/test/js/samples/css-shadow-dom-keyframes/expected.js b/test/js/samples/css-shadow-dom-keyframes/expected.js
index c004ec7df6..d921b0e79f 100644
--- a/test/js/samples/css-shadow-dom-keyframes/expected.js
+++ b/test/js/samples/css-shadow-dom-keyframes/expected.js
@@ -28,7 +28,7 @@ class SvelteComponent extends HTMLElement {
constructor(options = {}) {
super();
init(this, options);
- this._state = options.data || {};
+ this._state = assign({}, options.data);
this.attachShadow({ mode: 'open' });
this.shadowRoot.innerHTML = ``;
diff --git a/test/js/samples/each-block-changed-check/expected-bundle.js b/test/js/samples/each-block-changed-check/expected-bundle.js
index 33bd98ba74..8c0bd0b2cb 100644
--- a/test/js/samples/each-block-changed-check/expected-bundle.js
+++ b/test/js/samples/each-block-changed-check/expected-bundle.js
@@ -338,7 +338,7 @@ function create_each_block(state, comments, comment, i, component) {
function SvelteComponent(options) {
init(this, options);
- this._state = options.data || {};
+ this._state = assign({}, options.data);
this._fragment = create_main_fragment(this._state, this);
diff --git a/test/js/samples/each-block-changed-check/expected.js b/test/js/samples/each-block-changed-check/expected.js
index 37c12c1acd..be8a4943b5 100644
--- a/test/js/samples/each-block-changed-check/expected.js
+++ b/test/js/samples/each-block-changed-check/expected.js
@@ -141,7 +141,7 @@ function create_each_block(state, comments, comment, i, component) {
function SvelteComponent(options) {
init(this, options);
- this._state = options.data || {};
+ this._state = assign({}, options.data);
this._fragment = create_main_fragment(this._state, this);
diff --git a/test/js/samples/event-handlers-custom/expected-bundle.js b/test/js/samples/event-handlers-custom/expected-bundle.js
index a712f5b742..275a0377c7 100644
--- a/test/js/samples/event-handlers-custom/expected-bundle.js
+++ b/test/js/samples/event-handlers-custom/expected-bundle.js
@@ -223,7 +223,7 @@ function create_main_fragment(state, component) {
function SvelteComponent(options) {
init(this, options);
- this._state = options.data || {};
+ this._state = assign({}, options.data);
this._fragment = create_main_fragment(this._state, this);
diff --git a/test/js/samples/event-handlers-custom/expected.js b/test/js/samples/event-handlers-custom/expected.js
index 3739ada3a6..f7862efb62 100644
--- a/test/js/samples/event-handlers-custom/expected.js
+++ b/test/js/samples/event-handlers-custom/expected.js
@@ -46,7 +46,7 @@ function create_main_fragment(state, component) {
function SvelteComponent(options) {
init(this, options);
- this._state = options.data || {};
+ this._state = assign({}, options.data);
this._fragment = create_main_fragment(this._state, this);
diff --git a/test/js/samples/if-block-no-update/expected-bundle.js b/test/js/samples/if-block-no-update/expected-bundle.js
index f68dbd24e3..a9077ff2ac 100644
--- a/test/js/samples/if-block-no-update/expected-bundle.js
+++ b/test/js/samples/if-block-no-update/expected-bundle.js
@@ -271,7 +271,7 @@ function select_block_type(state) {
function SvelteComponent(options) {
init(this, options);
- this._state = options.data || {};
+ this._state = assign({}, options.data);
this._fragment = create_main_fragment(this._state, this);
diff --git a/test/js/samples/if-block-no-update/expected.js b/test/js/samples/if-block-no-update/expected.js
index 6a0a4456c5..8f030e4e53 100644
--- a/test/js/samples/if-block-no-update/expected.js
+++ b/test/js/samples/if-block-no-update/expected.js
@@ -90,7 +90,7 @@ function select_block_type(state) {
function SvelteComponent(options) {
init(this, options);
- this._state = options.data || {};
+ this._state = assign({}, options.data);
this._fragment = create_main_fragment(this._state, this);
diff --git a/test/js/samples/if-block-simple/expected-bundle.js b/test/js/samples/if-block-simple/expected-bundle.js
index 9c99dd0275..c0ff5cc5a9 100644
--- a/test/js/samples/if-block-simple/expected-bundle.js
+++ b/test/js/samples/if-block-simple/expected-bundle.js
@@ -247,7 +247,7 @@ function create_if_block(state, component) {
function SvelteComponent(options) {
init(this, options);
- this._state = options.data || {};
+ this._state = assign({}, options.data);
this._fragment = create_main_fragment(this._state, this);
diff --git a/test/js/samples/if-block-simple/expected.js b/test/js/samples/if-block-simple/expected.js
index 9bfd8e211d..0b9fbece70 100644
--- a/test/js/samples/if-block-simple/expected.js
+++ b/test/js/samples/if-block-simple/expected.js
@@ -66,7 +66,7 @@ function create_if_block(state, component) {
function SvelteComponent(options) {
init(this, options);
- this._state = options.data || {};
+ this._state = assign({}, options.data);
this._fragment = create_main_fragment(this._state, this);
diff --git a/test/js/samples/inline-style-optimized-multiple/expected-bundle.js b/test/js/samples/inline-style-optimized-multiple/expected-bundle.js
index 80998f97b2..adeb003a8d 100644
--- a/test/js/samples/inline-style-optimized-multiple/expected-bundle.js
+++ b/test/js/samples/inline-style-optimized-multiple/expected-bundle.js
@@ -220,7 +220,7 @@ function create_main_fragment(state, component) {
function SvelteComponent(options) {
init(this, options);
- this._state = options.data || {};
+ this._state = assign({}, options.data);
this._fragment = create_main_fragment(this._state, this);
diff --git a/test/js/samples/inline-style-optimized-multiple/expected.js b/test/js/samples/inline-style-optimized-multiple/expected.js
index a92f5d3053..77173460e2 100644
--- a/test/js/samples/inline-style-optimized-multiple/expected.js
+++ b/test/js/samples/inline-style-optimized-multiple/expected.js
@@ -39,7 +39,7 @@ function create_main_fragment(state, component) {
function SvelteComponent(options) {
init(this, options);
- this._state = options.data || {};
+ this._state = assign({}, options.data);
this._fragment = create_main_fragment(this._state, this);
diff --git a/test/js/samples/inline-style-optimized-url/expected-bundle.js b/test/js/samples/inline-style-optimized-url/expected-bundle.js
index 236aaee071..6ec70a5669 100644
--- a/test/js/samples/inline-style-optimized-url/expected-bundle.js
+++ b/test/js/samples/inline-style-optimized-url/expected-bundle.js
@@ -215,7 +215,7 @@ function create_main_fragment(state, component) {
function SvelteComponent(options) {
init(this, options);
- this._state = options.data || {};
+ this._state = assign({}, options.data);
this._fragment = create_main_fragment(this._state, this);
diff --git a/test/js/samples/inline-style-optimized-url/expected.js b/test/js/samples/inline-style-optimized-url/expected.js
index e10acd8dd8..bed00356f6 100644
--- a/test/js/samples/inline-style-optimized-url/expected.js
+++ b/test/js/samples/inline-style-optimized-url/expected.js
@@ -34,7 +34,7 @@ function create_main_fragment(state, component) {
function SvelteComponent(options) {
init(this, options);
- this._state = options.data || {};
+ this._state = assign({}, options.data);
this._fragment = create_main_fragment(this._state, this);
diff --git a/test/js/samples/inline-style-optimized/expected-bundle.js b/test/js/samples/inline-style-optimized/expected-bundle.js
index f8084094be..2e8ef6da17 100644
--- a/test/js/samples/inline-style-optimized/expected-bundle.js
+++ b/test/js/samples/inline-style-optimized/expected-bundle.js
@@ -215,7 +215,7 @@ function create_main_fragment(state, component) {
function SvelteComponent(options) {
init(this, options);
- this._state = options.data || {};
+ this._state = assign({}, options.data);
this._fragment = create_main_fragment(this._state, this);
diff --git a/test/js/samples/inline-style-optimized/expected.js b/test/js/samples/inline-style-optimized/expected.js
index e9d42fec07..7f873e296c 100644
--- a/test/js/samples/inline-style-optimized/expected.js
+++ b/test/js/samples/inline-style-optimized/expected.js
@@ -34,7 +34,7 @@ function create_main_fragment(state, component) {
function SvelteComponent(options) {
init(this, options);
- this._state = options.data || {};
+ this._state = assign({}, options.data);
this._fragment = create_main_fragment(this._state, this);
diff --git a/test/js/samples/inline-style-unoptimized/expected-bundle.js b/test/js/samples/inline-style-unoptimized/expected-bundle.js
index d0b2a2dcfe..bf78dac074 100644
--- a/test/js/samples/inline-style-unoptimized/expected-bundle.js
+++ b/test/js/samples/inline-style-unoptimized/expected-bundle.js
@@ -226,7 +226,7 @@ function create_main_fragment(state, component) {
function SvelteComponent(options) {
init(this, options);
- this._state = options.data || {};
+ this._state = assign({}, options.data);
this._fragment = create_main_fragment(this._state, this);
diff --git a/test/js/samples/inline-style-unoptimized/expected.js b/test/js/samples/inline-style-unoptimized/expected.js
index b2b4f5ad53..4c4d38d2bf 100644
--- a/test/js/samples/inline-style-unoptimized/expected.js
+++ b/test/js/samples/inline-style-unoptimized/expected.js
@@ -45,7 +45,7 @@ function create_main_fragment(state, component) {
function SvelteComponent(options) {
init(this, options);
- this._state = options.data || {};
+ this._state = assign({}, options.data);
this._fragment = create_main_fragment(this._state, this);
diff --git a/test/js/samples/input-without-blowback-guard/expected-bundle.js b/test/js/samples/input-without-blowback-guard/expected-bundle.js
index 792342604d..fd043c760e 100644
--- a/test/js/samples/input-without-blowback-guard/expected-bundle.js
+++ b/test/js/samples/input-without-blowback-guard/expected-bundle.js
@@ -226,7 +226,7 @@ function create_main_fragment(state, component) {
function SvelteComponent(options) {
init(this, options);
- this._state = options.data || {};
+ this._state = assign({}, options.data);
this._fragment = create_main_fragment(this._state, this);
diff --git a/test/js/samples/input-without-blowback-guard/expected.js b/test/js/samples/input-without-blowback-guard/expected.js
index f9ae72b1bd..247935ffbe 100644
--- a/test/js/samples/input-without-blowback-guard/expected.js
+++ b/test/js/samples/input-without-blowback-guard/expected.js
@@ -41,7 +41,7 @@ function create_main_fragment(state, component) {
function SvelteComponent(options) {
init(this, options);
- this._state = options.data || {};
+ this._state = assign({}, options.data);
this._fragment = create_main_fragment(this._state, this);
diff --git a/test/js/samples/legacy-input-type/expected-bundle.js b/test/js/samples/legacy-input-type/expected-bundle.js
index 26f30cf194..a6b6ae4d05 100644
--- a/test/js/samples/legacy-input-type/expected-bundle.js
+++ b/test/js/samples/legacy-input-type/expected-bundle.js
@@ -213,7 +213,7 @@ function create_main_fragment(state, component) {
function SvelteComponent(options) {
init(this, options);
- this._state = options.data || {};
+ this._state = assign({}, options.data);
this._fragment = create_main_fragment(this._state, this);
diff --git a/test/js/samples/legacy-input-type/expected.js b/test/js/samples/legacy-input-type/expected.js
index 5309c86cfd..719f550044 100644
--- a/test/js/samples/legacy-input-type/expected.js
+++ b/test/js/samples/legacy-input-type/expected.js
@@ -30,7 +30,7 @@ function create_main_fragment(state, component) {
function SvelteComponent(options) {
init(this, options);
- this._state = options.data || {};
+ this._state = assign({}, options.data);
this._fragment = create_main_fragment(this._state, this);
diff --git a/test/js/samples/legacy-quote-class/expected-bundle.js b/test/js/samples/legacy-quote-class/expected-bundle.js
index 3be6136b4a..b10d660076 100644
--- a/test/js/samples/legacy-quote-class/expected-bundle.js
+++ b/test/js/samples/legacy-quote-class/expected-bundle.js
@@ -238,7 +238,7 @@ function create_main_fragment(state, component) {
function SvelteComponent(options) {
init(this, options);
- this._state = options.data || {};
+ this._state = assign({}, options.data);
this._fragment = create_main_fragment(this._state, this);
diff --git a/test/js/samples/legacy-quote-class/expected.js b/test/js/samples/legacy-quote-class/expected.js
index 82eebe600c..0b49103c47 100644
--- a/test/js/samples/legacy-quote-class/expected.js
+++ b/test/js/samples/legacy-quote-class/expected.js
@@ -38,7 +38,7 @@ function create_main_fragment(state, component) {
function SvelteComponent(options) {
init(this, options);
- this._state = options.data || {};
+ this._state = assign({}, options.data);
this._fragment = create_main_fragment(this._state, this);
diff --git a/test/js/samples/media-bindings/expected-bundle.js b/test/js/samples/media-bindings/expected-bundle.js
index 820db0a4fe..068c1b4b15 100644
--- a/test/js/samples/media-bindings/expected-bundle.js
+++ b/test/js/samples/media-bindings/expected-bundle.js
@@ -302,7 +302,7 @@ function create_main_fragment(state, component) {
function SvelteComponent(options) {
init(this, options);
- this._state = options.data || {};
+ this._state = assign({}, options.data);
if (!options._root) {
this._oncreate = [];
diff --git a/test/js/samples/media-bindings/expected.js b/test/js/samples/media-bindings/expected.js
index 832826ffd5..bcab29fb75 100644
--- a/test/js/samples/media-bindings/expected.js
+++ b/test/js/samples/media-bindings/expected.js
@@ -109,7 +109,7 @@ function create_main_fragment(state, component) {
function SvelteComponent(options) {
init(this, options);
- this._state = options.data || {};
+ this._state = assign({}, options.data);
if (!options._root) {
this._oncreate = [];
diff --git a/test/js/samples/non-imported-component/expected-bundle.js b/test/js/samples/non-imported-component/expected-bundle.js
index 0aefe73b06..3793f0c102 100644
--- a/test/js/samples/non-imported-component/expected-bundle.js
+++ b/test/js/samples/non-imported-component/expected-bundle.js
@@ -221,7 +221,7 @@ function create_main_fragment(state, component) {
function SvelteComponent(options) {
init(this, options);
- this._state = options.data || {};
+ this._state = assign({}, options.data);
if (!options._root) {
this._oncreate = [];
diff --git a/test/js/samples/non-imported-component/expected.js b/test/js/samples/non-imported-component/expected.js
index 1f07457149..234a824e6c 100644
--- a/test/js/samples/non-imported-component/expected.js
+++ b/test/js/samples/non-imported-component/expected.js
@@ -45,7 +45,7 @@ function create_main_fragment(state, component) {
function SvelteComponent(options) {
init(this, options);
- this._state = options.data || {};
+ this._state = assign({}, options.data);
if (!options._root) {
this._oncreate = [];
diff --git a/test/js/samples/onrender-onteardown-rewritten/expected-bundle.js b/test/js/samples/onrender-onteardown-rewritten/expected-bundle.js
index 28dafe0c0d..59fbfcf41f 100644
--- a/test/js/samples/onrender-onteardown-rewritten/expected-bundle.js
+++ b/test/js/samples/onrender-onteardown-rewritten/expected-bundle.js
@@ -187,7 +187,7 @@ function create_main_fragment(state, component) {
function SvelteComponent(options) {
init(this, options);
- this._state = options.data || {};
+ this._state = assign({}, options.data);
this._handlers.destroy = [ondestroy];
diff --git a/test/js/samples/onrender-onteardown-rewritten/expected.js b/test/js/samples/onrender-onteardown-rewritten/expected.js
index 95f923e4d4..19b85a62e0 100644
--- a/test/js/samples/onrender-onteardown-rewritten/expected.js
+++ b/test/js/samples/onrender-onteardown-rewritten/expected.js
@@ -22,7 +22,7 @@ function create_main_fragment(state, component) {
function SvelteComponent(options) {
init(this, options);
- this._state = options.data || {};
+ this._state = assign({}, options.data);
this._handlers.destroy = [ondestroy]
diff --git a/test/js/samples/setup-method/expected-bundle.js b/test/js/samples/setup-method/expected-bundle.js
index 42eed6868b..7724d9f3ac 100644
--- a/test/js/samples/setup-method/expected-bundle.js
+++ b/test/js/samples/setup-method/expected-bundle.js
@@ -199,7 +199,7 @@ function create_main_fragment(state, component) {
function SvelteComponent(options) {
init(this, options);
- this._state = options.data || {};
+ this._state = assign({}, options.data);
this._fragment = create_main_fragment(this._state, this);
diff --git a/test/js/samples/setup-method/expected.js b/test/js/samples/setup-method/expected.js
index f49817bb99..092a32ed3b 100644
--- a/test/js/samples/setup-method/expected.js
+++ b/test/js/samples/setup-method/expected.js
@@ -34,7 +34,7 @@ function create_main_fragment(state, component) {
function SvelteComponent(options) {
init(this, options);
- this._state = options.data || {};
+ this._state = assign({}, options.data);
this._fragment = create_main_fragment(this._state, this);
diff --git a/test/js/samples/use-elements-as-anchors/expected-bundle.js b/test/js/samples/use-elements-as-anchors/expected-bundle.js
index 92e3f9bbd3..1f56c0ba7b 100644
--- a/test/js/samples/use-elements-as-anchors/expected-bundle.js
+++ b/test/js/samples/use-elements-as-anchors/expected-bundle.js
@@ -437,7 +437,7 @@ function create_if_block_4(state, component) {
function SvelteComponent(options) {
init(this, options);
- this._state = options.data || {};
+ this._state = assign({}, options.data);
this._fragment = create_main_fragment(this._state, this);
diff --git a/test/js/samples/use-elements-as-anchors/expected.js b/test/js/samples/use-elements-as-anchors/expected.js
index f23b9ec205..d2609c45b0 100644
--- a/test/js/samples/use-elements-as-anchors/expected.js
+++ b/test/js/samples/use-elements-as-anchors/expected.js
@@ -248,7 +248,7 @@ function create_if_block_4(state, component) {
function SvelteComponent(options) {
init(this, options);
- this._state = options.data || {};
+ this._state = assign({}, options.data);
this._fragment = create_main_fragment(this._state, this);