diff --git a/dist/alt-browser-with-addons.js b/dist/alt-browser-with-addons.js index bdb17da7..485fd6bc 100644 --- a/dist/alt-browser-with-addons.js +++ b/dist/alt-browser-with-addons.js @@ -1451,6 +1451,7 @@ var Alt = (function () { if (store[LIFECYCLE].rollback) { store[LIFECYCLE].rollback(); } + store.emitChange(); }); } }, @@ -1483,6 +1484,7 @@ var Alt = (function () { if (store[LIFECYCLE].bootstrap) { store[LIFECYCLE].bootstrap(); } + store.emitChange(); }); } }, diff --git a/dist/alt-browser.js b/dist/alt-browser.js index 85684ca3..6fb03bfd 100644 --- a/dist/alt-browser.js +++ b/dist/alt-browser.js @@ -1195,6 +1195,7 @@ var Alt = (function () { if (store[LIFECYCLE].rollback) { store[LIFECYCLE].rollback(); } + store.emitChange(); }); } }, @@ -1227,6 +1228,7 @@ var Alt = (function () { if (store[LIFECYCLE].bootstrap) { store[LIFECYCLE].bootstrap(); } + store.emitChange(); }); } }, diff --git a/dist/alt-with-runtime.js b/dist/alt-with-runtime.js index a1a7d906..6f69111a 100644 --- a/dist/alt-with-runtime.js +++ b/dist/alt-with-runtime.js @@ -471,6 +471,7 @@ var Alt = (function () { if (store[LIFECYCLE].rollback) { store[LIFECYCLE].rollback(); } + store.emitChange(); }); }, writable: true, @@ -509,6 +510,7 @@ var Alt = (function () { if (store[LIFECYCLE].bootstrap) { store[LIFECYCLE].bootstrap(); } + store.emitChange(); }); }, writable: true, diff --git a/dist/alt.js b/dist/alt.js index 596a2027..48f87fb2 100644 --- a/dist/alt.js +++ b/dist/alt.js @@ -488,6 +488,7 @@ var Alt = (function () { if (store[LIFECYCLE].rollback) { store[LIFECYCLE].rollback(); } + store.emitChange(); }); }, writable: true, @@ -526,6 +527,7 @@ var Alt = (function () { if (store[LIFECYCLE].bootstrap) { store[LIFECYCLE].bootstrap(); } + store.emitChange(); }); }, writable: true, diff --git a/docs/bootstrap.md b/docs/bootstrap.md index 27c4a62b..f6fda480 100644 --- a/docs/bootstrap.md +++ b/docs/bootstrap.md @@ -9,19 +9,7 @@ permalink: /docs/bootstrap/ > (data: string): undefined -The `alt.bootstrap()` function takes in a snapshot you've saved and reloads all the state with that snapshot, no events will be emitted to your components during this process, so it is advised to do this on init before the view has even rendered. - -If you want to emit a change event after bootstrapping you can use [`this.emitChange`](stores.md#storeemitchange) inside of the [bootstrap lifecycle method](lifecycleListeners.md#bootstrap). - -```js -class MyStore { - constructor() { - this.on('bootstrap', () => - this.emitChange(); - }); - } -} -``` +The `alt.bootstrap()` function takes in a snapshot you've saved and reloads every store's state with that the data provided in that snapshot. Bootstrap is great if you're running an isomorphic app, or if you're persisting state to localstorage and then retrieving it on init later on. You can save a snapshot on the server side, send it down, and then bootstrap it back on the client. diff --git a/src/alt.js b/src/alt.js index c7cf21d8..45f2340e 100644 --- a/src/alt.js +++ b/src/alt.js @@ -394,6 +394,7 @@ class Alt { if (store[LIFECYCLE].rollback) { store[LIFECYCLE].rollback() } + store.emitChange() }) } @@ -421,6 +422,7 @@ class Alt { if (store[LIFECYCLE].bootstrap) { store[LIFECYCLE].bootstrap() } + store.emitChange() }) } diff --git a/test/index.js b/test/index.js index 6f747fa7..7b0266cf 100644 --- a/test/index.js +++ b/test/index.js @@ -110,7 +110,7 @@ class MyStore { } externalMethodNoStatic() { - return true + return true } }