Skip to content

Commit

Permalink
fix small bug in init that casused confusing log output
Browse files Browse the repository at this point in the history
  • Loading branch information
tpresley committed May 6, 2024
1 parent 8c0a1e3 commit f19add2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions src/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 }`)
Expand Down

0 comments on commit f19add2

Please sign in to comment.