Skip to content

Commit f6430c6

Browse files
fix(docs): fix failed markdown
1 parent fc972d5 commit f6430c6

File tree

4 files changed

+68
-50
lines changed

4 files changed

+68
-50
lines changed

docs/docs/with-devtools.md

Lines changed: 33 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ The extensions don't activate during app initialization (as it is with `@ngrx/st
2525

2626
<img src="../img/devtools.png" width="1000" />
2727

28-
## `updateState` vs `patchState`
28+
## `updateState()` vs `patchState()`
2929

30-
The Signal Store does not use the Redux pattern, so there are no action names involved by default. Instead, every action is referred to as a "Store Update". If you want to customize the action name for better clarity, you can use the `updateState` function instead of `patchState`:
30+
The Signal Store does not use the Redux pattern, so there are no action names involved by default. Instead, every action is referred to as a "Store Update". If you want to customize the action name for better clarity, you can use the `updateState()` function instead of `patchState()`:
3131

3232
```typescript
3333
patchState(this.store, { loading: false });
@@ -36,11 +36,11 @@ patchState(this.store, { loading: false });
3636
updateState(this.store, 'update loading', { loading: false });
3737
```
3838

39-
## `renameDevtoolsName`
39+
## `renameDevtoolsName()`
4040

4141
If multiple instances of a given SignalStore exist, the Devtools will index the names. For example, if you have two `TodoDetail` instances with the name `todo-detail`, the first one will be named `todo-detail` and the second one `todo-detail-1`.
4242

43-
At any time, you can use `renameDevtoolsName` to change the name of the store in the Devtools.
43+
At any time, you can use `renameDevtoolsName()` to change the name of the store in the Devtools.
4444

4545
The following example shows a component, which has a locally provided store and renames it according to the `id` of the `todo` Signal.
4646

@@ -90,15 +90,15 @@ store.increase(); // would show up in the DevTools with value 2
9090
store.increase(); // would show up in the DevTools with value 3
9191
```
9292

93-
Without `withGlitchTracking`, the DevTools would only show the final value of 3.
93+
Without `withGlitchTracking()`, the DevTools would only show the final value of 3.
9494

95-
It is also possible to mix. So one store could have `withGlitchTracking` and another one not.
95+
It is also possible to mix. So one store could have `withGlitchTracking()` and another one not.
9696

9797
## `withDisabledNameIndices()`
9898

99-
`withDevtools` foresees the possibility to add features which extend or modify it. At the moment, `withDisabledNameIndices` is the only feature available. It disables the automatic indexing of the store names in the Devtools.
99+
`withDevtools()` foresees the possibility to add features which extend or modify it. At the moment, `withDisabledNameIndices()` is the only feature available. It disables the automatic indexing of the store names in the Devtools.
100100

101-
If multiple instances exist at the same time, `withDisabledNameIndices` will throw an error. This is useful if you want to ensure that only one instance of a store is active at a time or that the store name is unique.
101+
If multiple instances exist at the same time, `withDisabledNameIndices()` will throw an error. This is useful if you want to ensure that only one instance of a store is active at a time or that the store name is unique.
102102

103103
You activate per store:
104104

@@ -108,17 +108,32 @@ const Store = signalStore({ providedIn: 'root' }, withDevtools('flights', withDi
108108

109109
## `withMapper()`
110110

111-
`withMapper` allows you to define a function that maps the state before it is sent to the Devtools.
111+
`withMapper()` allows you to define a function that maps the state before it is sent to the Devtools.
112112

113113
Sometimes, it is necessary to map the state before it is sent to the Devtools. For example, you might want to exclude some properties, like passwords or other sensitive data.
114114

115-
````typescript
115+
```typescript
116+
const initialState = {
117+
id: 1,
118+
119+
name: 'John List',
120+
enteredPassword: '',
121+
};
122+
123+
const Store = signalStore(
124+
withState(initialState),
125+
withDevtools(
126+
'user',
127+
withMapper((state) => ({ ...state, enteredPassword: '***' }))
128+
)
129+
);
130+
```
116131

117132
## Disabling Devtools in production
118133

119134
`withDevtools()` is by default enabled in production mode, if you want to tree-shake it from the application bundle you need to abstract it in your environment file.
120135

121-
It is required to add the `withDevtools` function to the environment files.
136+
It is required to add the `withDevtools()` function to the environment files.
122137

123138
environments/environment.ts:
124139

@@ -128,7 +143,7 @@ import { withDevtools } from '@angular-architects/ngrx-toolkit';
128143
export const environment = {
129144
storeWithDevTools: withDevtools,
130145
};
131-
````
146+
```
132147

133148
environments/environment.prod.ts
134149

@@ -160,10 +175,12 @@ export const SomeStore = signalStore(withState({ strings: [] as string[] }), wit
160175
Also make sure you have defined file replacements in angular.json prod configuration:
161176

162177
```json
163-
"fileReplacements": [
164178
{
165-
"replace": "src/environments/environment.ts",
166-
"with": "src/environments/environment.prod.ts"
179+
"fileReplacements": [
180+
{
181+
"replace": "src/environments/environment.ts",
182+
"with": "src/environments/environment.prod.ts"
183+
}
184+
]
167185
}
168-
]
169186
```

libs/ngrx-toolkit/src/lib/devtools/features/with-disabled-name-indicies.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,25 @@ import { createDevtoolsFeature } from '../internal/devtools-feature';
55
* exist, their devtool names are indexed.
66
*
77
* For example:
8-
* <pre>
8+
*
9+
* ```typescript
910
* const Store = signalStore(
1011
* withDevtools('flights')
1112
* )
1213
*
1314
* const store1 = new Store(); // will show up as 'flights'
1415
* const store2 = new Store(); // will show up as 'flights-1'
15-
* </pre>
16+
* ```
1617
*
1718
* With adding `withDisabledNameIndices` to the store:
18-
* <pre>
19+
* ```typescript
1920
* const Store = signalStore(
2021
* withDevtools('flights', withDisabledNameIndices())
2122
* )
2223
*
2324
* const store1 = new Store(); // will show up as 'flights'
2425
* const store2 = new Store(); //💥 throws an error
25-
* </pre>
26+
* ```
2627
*
2728
*/
2829
export function withDisabledNameIndices() {

libs/ngrx-toolkit/src/lib/devtools/features/with-glitch-tracking.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,24 @@ import { GlitchTrackerService } from '../internal/glitch-tracker.service';
99
*
1010
* Example:
1111
*
12-
* <pre>
13-
* const Store = signalStore(
14-
* { providedIn: 'root' },
15-
* withState({ count: 0 }),
16-
* withDevtools('counter', withGlitchTracking()),
17-
* withMethods((store) => ({
18-
* increase: () =>
19-
* patchState(store, (value) => ({ count: value.count + 1 })),
20-
* }))
21-
* );
12+
* ```typescript
13+
* const Store = signalStore(
14+
* { providedIn: 'root' },
15+
* withState({ count: 0 }),
16+
* withDevtools('counter', withGlitchTracking()),
17+
* withMethods((store) => ({
18+
* increase: () =>
19+
* patchState(store, (value) => ({ count: value.count + 1 })),
20+
* }))
21+
* );
2222
*
23-
* // would show up in the DevTools with value 0
24-
* const store = inject(Store);
23+
* // would show up in the DevTools with value 0
24+
* const store = inject(Store);
2525
*
26-
* store.increase(); // would show up in the DevTools with value 1
27-
* store.increase(); // would show up in the DevTools with value 2
28-
* store.increase(); // would show up in the DevTools with value 3
29-
* </pre>
26+
* store.increase(); // would show up in the DevTools with value 1
27+
* store.increase(); // would show up in the DevTools with value 2
28+
* store.increase(); // would show up in the DevTools with value 3
29+
* ```
3030
*
3131
* Without `withGlitchTracking`, the DevTools would only show the final value of 3.
3232
*/

libs/ngrx-toolkit/src/lib/devtools/features/with-mapper.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,22 @@ import { createDevtoolsFeature, Mapper } from '../internal/devtools-feature';
88
*
99
* Example:
1010
*
11-
* <pre>
12-
* const initialState = {
13-
* id: 1,
14-
* email: 'john.list@host.com',
15-
* name: 'John List',
16-
* enteredPassword: ''
17-
* }
11+
* ```typescript
12+
* const initialState = {
13+
* id: 1,
14+
* email: 'john.list@host.com',
15+
* name: 'John List',
16+
* enteredPassword: ''
17+
* }
1818
*
19-
* const Store = signalStore(
20-
* withState(initialState),
21-
* withDevtools(
22-
* 'user',
23-
* withMapper(state => ({state, { enteredPassword: '***' }}))
24-
* )
19+
* const Store = signalStore(
20+
* withState(initialState),
21+
* withDevtools(
22+
* 'user',
23+
* withMapper(state => ({...state, enteredPassword: '***' }))
2524
* )
26-
* </pre>
25+
* )
26+
* ```
2727
*
2828
* @param map function which maps the state
2929
*/

0 commit comments

Comments
 (0)