From 6596913da359c427133e0002c78578fee67df2e3 Mon Sep 17 00:00:00 2001 From: James Birtles Date: Wed, 17 Jan 2018 18:04:47 +0000 Subject: [PATCH 1/2] addd failing nested store test --- test/runtime/samples/store-nested/Nested.html | 13 +++++++++++++ test/runtime/samples/store-nested/_config.js | 7 +++++++ test/runtime/samples/store-nested/main.html | 11 +++++++++++ 3 files changed, 31 insertions(+) create mode 100644 test/runtime/samples/store-nested/Nested.html create mode 100644 test/runtime/samples/store-nested/_config.js create mode 100644 test/runtime/samples/store-nested/main.html diff --git a/test/runtime/samples/store-nested/Nested.html b/test/runtime/samples/store-nested/Nested.html new file mode 100644 index 0000000000..01662eceac --- /dev/null +++ b/test/runtime/samples/store-nested/Nested.html @@ -0,0 +1,13 @@ +

Hello, {{$name}}!

+ + diff --git a/test/runtime/samples/store-nested/_config.js b/test/runtime/samples/store-nested/_config.js new file mode 100644 index 0000000000..bad5ddeffb --- /dev/null +++ b/test/runtime/samples/store-nested/_config.js @@ -0,0 +1,7 @@ +export default { + store: true, // TODO remove this in v2 + + html: ` +

Hello, world!

+ `, +}; diff --git a/test/runtime/samples/store-nested/main.html b/test/runtime/samples/store-nested/main.html new file mode 100644 index 0000000000..a1e069b2a1 --- /dev/null +++ b/test/runtime/samples/store-nested/main.html @@ -0,0 +1,11 @@ + + + From b180f8a67b0bdf716dbc17f53f1b4abcefe117c9 Mon Sep 17 00:00:00 2001 From: James Birtles Date: Wed, 17 Jan 2018 18:07:08 +0000 Subject: [PATCH 2/2] create store in _render, fixes #1107 --- src/generators/server-side-rendering/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/generators/server-side-rendering/index.ts b/src/generators/server-side-rendering/index.ts index 37bf859da7..c998cb894b 100644 --- a/src/generators/server-side-rendering/index.ts +++ b/src/generators/server-side-rendering/index.ts @@ -114,7 +114,6 @@ export default function ssr( } var result = { head: '', addComponent }; - ${templateProperties.store && `options.store = %store();`} var html = ${name}._render(result, state, options); var cssCode = Array.from(components).map(c => c.css && c.css.code).filter(Boolean).join('\\n'); @@ -130,6 +129,7 @@ export default function ssr( } ${name}._render = function(__result, state, options) { + ${templateProperties.store && `options.store = %store();`} __result.addComponent(${name}); state = Object.assign(${initialState.join(', ')});