Skip to content

Commit 0728fd9

Browse files
christianalfonigitbook-bot
authored andcommitted
GitBook: [master] 4 pages modified
1 parent 0a60805 commit 0728fd9

File tree

4 files changed

+11
-53
lines changed

4 files changed

+11
-53
lines changed

core/defining-state.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,13 @@ Are things loading or not, is the user logged in or not? These are typical uses
7070

7171
All values, with the exception of booleans, can also be **null**. Non-existing. You can have a non-existing object, array, string or number. It means that if we haven’t selected a mode, both the string version and number version would have the value **null**.
7272

73+
## Undefined
74+
75+
You might wonder why **undefined** is not part of the core value types. Well, there are two reasons:
76+
77+
1. It is not a serializable value. That means if you explicitly set a value to _undefined_ it will not show up in the devtools
78+
2. Undefined values can not be tracked. That means if you were to iterate an object and look at the keys of that object, any undefined values will not be tracked. This can cause unexpected behaviour
79+
7380
## Class values
7481

7582
Overmind also supports using class instances as state values. Depending on your preference this can be a powerful tool to organize your logic. What classes provide is a way to co locate state and logic for changing and deriving that state. In functional programming the state and the logic is separated and it can be difficult to find a good way to organize the logic operating on that state.
@@ -389,13 +396,6 @@ You can reset the state of a statemachine, which also runs the exit of the curre
389396
state.mode.reset()
390397
```
391398

392-
## Undefined
393-
394-
You might wonder why **undefined** is not part of the core value types. Well, there are two reasons:
395-
396-
1. It is not a serializable value. That means if you explicitly set a value to _undefined_ it will not show up in the devtools
397-
2. Undefined values can not be tracked. That means if you were to iterate an object and look at the keys of that object, any undefined values will not be tracked. This can cause unexpected behaviour
398-
399399
## Deriving state
400400

401401
### Getter

core/typescript.md

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -387,43 +387,7 @@ export const filterAwesome: <T extends { isAwesome: boolean }>() => Operator<T>
387387

388388
That means this operator can handle any type that matches an **isAwesome** property, though will pass the original type through.
389389

390-
## Statemachine
391-
392-
Statemachines exposes a type called **Statemachine**, though it is strictly not necessary to use as it is recommended to separate your machine definition from your state using the factory:
393-
394-
{% tabs %}
395-
{% tab title="overmind/state.ts" %}
396-
```typescript
397-
import {statemachine } from 'overmind'
398-
399-
type Modes =
400-
| 'unauthenticated'
401-
| 'authenticating'
402-
| 'authenticated'
403-
| 'unauthenticating'
404-
405-
const mode = statemachine<Modes>({
406-
initial: 'unauthenticated',
407-
states: {
408-
unauthenticated: ['authenticating'],
409-
authenticating: ['unauthenticated', 'authenticated'],
410-
authenticated: ['unauthenticating'],
411-
unauthenticating: ['unauthenticated', 'authenticated']
412-
}
413-
})
414-
415-
type State = {
416-
mode: typeof mode
417-
}
418-
419-
export const state: State = {
420-
mode
421-
}
422-
```
423-
{% endtab %}
424-
{% endtabs %}
425-
426-
## Statechart
390+
## Statecharts
427391

428392
To type a statechart you use the **Statechart** type:
429393

faq.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,5 @@ First… try to refresh your app to reconnect. If this does not work make sure t
88

99
Restart VS Code
1010

11-
## My operator actions are not running?
12-
13-
Operators are identified with a Symbol. If you happen to use Overmind across packages you might be running two versions of Overmind. The same goes for core package and view package installed out of version sync. Make sure you are only running on package of Overmind by looking into your **node\_modules** folder.
14-
1511

1612

views/angular.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ import { AppComponent } from './app.component';
3939
declarations: [ AppComponent ],
4040
bootstrap: [ AppComponent ],
4141
providers: [
42-
{ provide: OVERMIND_INSTANCE, useFactory: () => createOvermind(config) },
42+
{ provide: OVERMIND_INSTANCE, useValue: createOvermind(config) },
4343
{ provide: Store, useExisting: OvermindService }
4444
]
4545
})
@@ -85,9 +85,7 @@ if (environment.production) {
8585
platformBrowserDynamic()
8686
.bootstrapModule(AppModule, {
8787
// We do not need zones, we rather use the tracking
88-
// directive, which gives us a pretty signifcant performance
89-
// boost. Note that 3rd party libraries might need ngZone,
90-
// in which case you can not set it to "noop"
88+
// directive, which gives us a huge optimization
9189
ngZone: "noop"
9290
})
9391
.catch(err => console.log(err));
@@ -126,7 +124,7 @@ You can now access the **admin** state and actions directly with **state** and *
126124

127125
## NgZone
128126

129-
The Overmind **\*track** directive knows when your components should update, and so is much more efficient at change detection than Angular's default NgZone. In order to take advantage of the efficiency provided by the \***track** directive, you _must_ set **ngZone** to "noop". Note that other 3rd party libraries may not support this. If for any reason you can't set **ngZone** to "noop", then the \***track** directive is redundant, and you can safely exclude it from your templates.
127+
Since Overmind knows when your components should update you can safely turn **ngZone** to `"noop"`. Note that other 3rd party libraries may not support this.
130128

131129
## Rendering
132130

0 commit comments

Comments
 (0)