From f19add23bd3b7caebe28566d6a6ad59772dd9866 Mon Sep 17 00:00:00 2001 From: Troy Presley Date: Mon, 6 May 2024 00:52:01 -1000 Subject: [PATCH] fix small bug in init that casused confusing log output --- README.md | 2 +- src/component.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 18d2d9a..6c4077d 100644 --- a/README.md +++ b/README.md @@ -683,7 +683,7 @@ npm run build The results will be in the 'dist' folder, and you can serve it locally by running: ```bash -npm preview +npm run preview ``` Alternatively, you can use any other bundler of your choice (Webpack, Babel, Rollup, etc.). To use JSX in your components while using alternative bundlers, you will need to configure your bundler to use Sygnal's JSX pragma. This is slightly different for each bundler, but looks generally like: diff --git a/src/component.js b/src/component.js index 1095d56..e06ba4a 100644 --- a/src/component.js +++ b/src/component.js @@ -230,7 +230,7 @@ class Component { const action$ = ((runner instanceof Stream) ? runner : (runner.apply && runner(this.sources) || xs.never())) const bootstrap$ = xs.of({ type: BOOTSTRAP_ACTION }).compose(delay(10)) - const wrapped$ = this.model[BOOTSTRAP_ACTION] ? concat(bootstrap$, action$) : concat(xs.of({}).compose(delay(1)), action$) + const wrapped$ = this.model[BOOTSTRAP_ACTION] ? concat(bootstrap$, action$) : concat(xs.of().compose(delay(1)).filter(_ => false), action$) let initialApiData @@ -248,12 +248,12 @@ class Component { } initState() { - if (this.model != undefined) { + if (this.model !== undefined) { if (this.model[INITIALIZE_ACTION] === undefined) { this.model[INITIALIZE_ACTION] = { [this.stateSourceName]: (_, data) => ({ ...this.addCalculated(data) }) } - } else { + } else if (isObj(this.model[INITIALIZE_ACTION])) { Object.keys(this.model[INITIALIZE_ACTION]).forEach(name => { if (name !== this.stateSourceName) { console.warn(`${ INITIALIZE_ACTION } can only be used with the ${ this.stateSourceName } source... disregarding ${ name }`)