Skip to content

Commit 4bd0022

Browse files
authored
Merge pull request #1552 from PaulMaly/1538-store-inheriting
Fix for #1538
2 parents 9cd5dd9 + 52ece0b commit 4bd0022

File tree

58 files changed

+77
-62
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+77
-62
lines changed

src/compile/nodes/Component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ export default class Component extends Node {
123123

124124
const name = this.var;
125125

126-
const componentInitProperties = [`root: #component.root`];
126+
const componentInitProperties = [`root: #component.root`, `store: #component.store`];
127127

128128
if (this.children.length > 0) {
129129
const slots = Array.from(this._slots).map(name => `${quoteNameIfNecessary(name)}: @createFragment()`);

src/shared/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export function init(component, options) {
6464

6565
component.options = options;
6666
component.root = options.root || component;
67-
component.store = component.root.store || options.store;
67+
component.store = options.store || component.root.store;
6868
}
6969

7070
export function on(eventName, handler) {

test/cli/samples/basic/expected/Main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ function init(component, options) {
6969

7070
component.options = options;
7171
component.root = options.root || component;
72-
component.store = component.root.store || options.store;
72+
component.store = options.store || component.root.store;
7373
}
7474

7575
function assign(tar, src) {

test/cli/samples/custom-element/expected/Main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ function init(component, options) {
9090

9191
component.options = options;
9292
component.root = options.root || component;
93-
component.store = component.root.store || options.store;
93+
component.store = options.store || component.root.store;
9494
}
9595

9696
function assign(tar, src) {

test/cli/samples/dev/expected/Main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ function init(component, options) {
9393

9494
component.options = options;
9595
component.root = options.root || component;
96-
component.store = component.root.store || options.store;
96+
component.store = options.store || component.root.store;
9797
}
9898

9999
function assign(tar, src) {

test/cli/samples/dir-sourcemap/expected/Main.js

Lines changed: 4 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/cli/samples/dir-sourcemap/expected/Main.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/cli/samples/dir-sourcemap/expected/Widget.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/cli/samples/dir-subdir/expected/Main.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ import Widget from './widget/Widget.html';
66
function create_main_fragment(component, ctx) {
77

88
var widget = new Widget({
9-
root: component.root
9+
root: component.root,
10+
store: component.store
1011
});
1112

1213
return {
@@ -72,7 +73,7 @@ function init(component, options) {
7273

7374
component.options = options;
7475
component.root = options.root || component;
75-
component.store = component.root.store || options.store;
76+
component.store = options.store || component.root.store;
7677
}
7778

7879
function assign(tar, src) {

test/cli/samples/dir-subdir/expected/widget/Widget.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ function init(component, options) {
6969

7070
component.options = options;
7171
component.root = options.root || component;
72-
component.store = component.root.store || options.store;
72+
component.store = options.store || component.root.store;
7373
}
7474

7575
function assign(tar, src) {

test/cli/samples/dir/expected/Main.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ import Widget from './Widget.html';
66
function create_main_fragment(component, ctx) {
77

88
var widget = new Widget({
9-
root: component.root
9+
root: component.root,
10+
store: component.store
1011
});
1112

1213
return {
@@ -72,7 +73,7 @@ function init(component, options) {
7273

7374
component.options = options;
7475
component.root = options.root || component;
75-
component.store = component.root.store || options.store;
76+
component.store = options.store || component.root.store;
7677
}
7778

7879
function assign(tar, src) {

test/cli/samples/dir/expected/Widget.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ function init(component, options) {
6969

7070
component.options = options;
7171
component.root = options.root || component;
72-
component.store = component.root.store || options.store;
72+
component.store = options.store || component.root.store;
7373
}
7474

7575
function assign(tar, src) {

test/cli/samples/globals/expected/Main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ var Main = (function(answer) { "use strict";
9090

9191
component.options = options;
9292
component.root = options.root || component;
93-
component.store = component.root.store || options.store;
93+
component.store = options.store || component.root.store;
9494
}
9595

9696
function assign(tar, src) {

test/cli/samples/sourcemap-inline/expected/Main.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/cli/samples/sourcemap/expected/Main.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/cli/samples/store/expected/Main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ function init(component, options) {
8585

8686
component.options = options;
8787
component.root = options.root || component;
88-
component.store = component.root.store || options.store;
88+
component.store = options.store || component.root.store;
8989
}
9090

9191
function assign(tar, src) {

test/js/samples/action/expected-bundle.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ function init(component, options) {
6161

6262
component.options = options;
6363
component.root = options.root || component;
64-
component.store = component.root.store || options.store;
64+
component.store = options.store || component.root.store;
6565
}
6666

6767
function on(eventName, handler) {

test/js/samples/bind-width-height/expected-bundle.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ function init(component, options) {
9393

9494
component.options = options;
9595
component.root = options.root || component;
96-
component.store = component.root.store || options.store;
96+
component.store = options.store || component.root.store;
9797
}
9898

9999
function on(eventName, handler) {

test/js/samples/collapses-text-around-comments/expected-bundle.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ function init(component, options) {
6969

7070
component.options = options;
7171
component.root = options.root || component;
72-
component.store = component.root.store || options.store;
72+
component.store = options.store || component.root.store;
7373
}
7474

7575
function on(eventName, handler) {

test/js/samples/component-static-array/expected-bundle.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ function init(component, options) {
4949

5050
component.options = options;
5151
component.root = options.root || component;
52-
component.store = component.root.store || options.store;
52+
component.store = options.store || component.root.store;
5353
}
5454

5555
function on(eventName, handler) {
@@ -124,6 +124,7 @@ function create_main_fragment(component, ctx) {
124124
var nested_initial_data = { foo: [1, 2, 3] };
125125
var nested = new Nested({
126126
root: component.root,
127+
store: component.store,
127128
data: nested_initial_data
128129
});
129130

test/js/samples/component-static-array/expected.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ function create_main_fragment(component, ctx) {
88
var nested_initial_data = { foo: [1, 2, 3] };
99
var nested = new Nested({
1010
root: component.root,
11+
store: component.store,
1112
data: nested_initial_data
1213
});
1314

test/js/samples/component-static-immutable/expected-bundle.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ function init(component, options) {
5353

5454
component.options = options;
5555
component.root = options.root || component;
56-
component.store = component.root.store || options.store;
56+
component.store = options.store || component.root.store;
5757
}
5858

5959
function on(eventName, handler) {
@@ -128,6 +128,7 @@ function create_main_fragment(component, ctx) {
128128
var nested_initial_data = { foo: "bar" };
129129
var nested = new Nested({
130130
root: component.root,
131+
store: component.store,
131132
data: nested_initial_data
132133
});
133134

test/js/samples/component-static-immutable/expected.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ function create_main_fragment(component, ctx) {
88
var nested_initial_data = { foo: "bar" };
99
var nested = new Nested({
1010
root: component.root,
11+
store: component.store,
1112
data: nested_initial_data
1213
});
1314

test/js/samples/component-static-immutable2/expected-bundle.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ function init(component, options) {
5353

5454
component.options = options;
5555
component.root = options.root || component;
56-
component.store = component.root.store || options.store;
56+
component.store = options.store || component.root.store;
5757
}
5858

5959
function on(eventName, handler) {
@@ -128,6 +128,7 @@ function create_main_fragment(component, ctx) {
128128
var nested_initial_data = { foo: "bar" };
129129
var nested = new Nested({
130130
root: component.root,
131+
store: component.store,
131132
data: nested_initial_data
132133
});
133134

test/js/samples/component-static-immutable2/expected.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ function create_main_fragment(component, ctx) {
88
var nested_initial_data = { foo: "bar" };
99
var nested = new Nested({
1010
root: component.root,
11+
store: component.store,
1112
data: nested_initial_data
1213
});
1314

test/js/samples/component-static/expected-bundle.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ function init(component, options) {
4949

5050
component.options = options;
5151
component.root = options.root || component;
52-
component.store = component.root.store || options.store;
52+
component.store = options.store || component.root.store;
5353
}
5454

5555
function on(eventName, handler) {
@@ -124,6 +124,7 @@ function create_main_fragment(component, ctx) {
124124
var nested_initial_data = { foo: "bar" };
125125
var nested = new Nested({
126126
root: component.root,
127+
store: component.store,
127128
data: nested_initial_data
128129
});
129130

test/js/samples/component-static/expected.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ function create_main_fragment(component, ctx) {
88
var nested_initial_data = { foo: "bar" };
99
var nested = new Nested({
1010
root: component.root,
11+
store: component.store,
1112
data: nested_initial_data
1213
});
1314

test/js/samples/computed-collapsed-if/expected-bundle.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ function init(component, options) {
4949

5050
component.options = options;
5151
component.root = options.root || component;
52-
component.store = component.root.store || options.store;
52+
component.store = options.store || component.root.store;
5353
}
5454

5555
function on(eventName, handler) {

test/js/samples/css-media-query/expected-bundle.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ function init(component, options) {
6565

6666
component.options = options;
6767
component.root = options.root || component;
68-
component.store = component.root.store || options.store;
68+
component.store = options.store || component.root.store;
6969
}
7070

7171
function on(eventName, handler) {

test/js/samples/css-shadow-dom-keyframes/expected-bundle.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ function init(component, options) {
6161

6262
component.options = options;
6363
component.root = options.root || component;
64-
component.store = component.root.store || options.store;
64+
component.store = options.store || component.root.store;
6565
}
6666

6767
function on(eventName, handler) {

test/js/samples/deconflict-builtins/expected-bundle.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ function init(component, options) {
7979

8080
component.options = options;
8181
component.root = options.root || component;
82-
component.store = component.root.store || options.store;
82+
component.store = options.store || component.root.store;
8383
}
8484

8585
function on(eventName, handler) {

test/js/samples/deconflict-globals/expected-bundle.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ function init(component, options) {
5454

5555
component.options = options;
5656
component.root = options.root || component;
57-
component.store = component.root.store || options.store;
57+
component.store = options.store || component.root.store;
5858
}
5959

6060
function on(eventName, handler) {

test/js/samples/dev-warning-missing-data-computed/expected-bundle.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ function init(component, options) {
8282

8383
component.options = options;
8484
component.root = options.root || component;
85-
component.store = component.root.store || options.store;
85+
component.store = options.store || component.root.store;
8686
}
8787

8888
function on(eventName, handler) {

test/js/samples/do-use-dataset/expected-bundle.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ function init(component, options) {
6565

6666
component.options = options;
6767
component.root = options.root || component;
68-
component.store = component.root.store || options.store;
68+
component.store = options.store || component.root.store;
6969
}
7070

7171
function on(eventName, handler) {

test/js/samples/dont-use-dataset-in-legacy/expected-bundle.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ function init(component, options) {
6969

7070
component.options = options;
7171
component.root = options.root || component;
72-
component.store = component.root.store || options.store;
72+
component.store = options.store || component.root.store;
7373
}
7474

7575
function on(eventName, handler) {

test/js/samples/dont-use-dataset-in-svg/expected-bundle.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ function init(component, options) {
6969

7070
component.options = options;
7171
component.root = options.root || component;
72-
component.store = component.root.store || options.store;
72+
component.store = options.store || component.root.store;
7373
}
7474

7575
function on(eventName, handler) {

test/js/samples/each-block-changed-check/expected-bundle.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ function init(component, options) {
8181

8282
component.options = options;
8383
component.root = options.root || component;
84-
component.store = component.root.store || options.store;
84+
component.store = options.store || component.root.store;
8585
}
8686

8787
function on(eventName, handler) {

0 commit comments

Comments
 (0)