Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename noopCheck to identityFunctionCheck #2091

Merged
merged 9 commits into from
Dec 3, 2023
Prev Previous commit
Add breaking change warning to docs
  • Loading branch information
aryaemami59 committed Dec 3, 2023
commit 07f306052cc50154d86f8a3e9bf944f931ffdde9
24 changes: 19 additions & 5 deletions docs/api/hooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -298,14 +298,24 @@ By default, this will only happen when the selector is first called. You can con

```tsx title="Individual hook setting"
function Component() {
const count = useSelector(selectCount, { stabilityCheck: 'never' })
const count = useSelector(selectCount, {
devModeChecks: { stabilityCheck: 'never' },
})
// run once (default)
const user = useSelector(selectUser, { stabilityCheck: 'once' })
const user = useSelector(selectUser, {
devModeChecks: { stabilityCheck: 'once' },
})
// ...
}
```

#### `identityFunctionCheck`
#### Identity Function (`state => state`) Check

:::danger Breaking Change!

This was previously referred to as `noopCheck`.

:::

In development, a check is conducted on the result returned by the selector. It warns in the console if the result is the same as the parameter passed in, i.e. the root state.

Expand All @@ -330,9 +340,13 @@ By default, this will only happen when the selector is first called. You can con

```tsx title="Individual hook setting"
function Component() {
const count = useSelector(selectCount, { identityFunctionCheck: 'never' })
const count = useSelector(selectCount, {
devModeChecks: { identityFunctionCheck: 'never' },
})
// run once (default)
const user = useSelector(selectUser, { identityFunctionCheck: 'once' })
const user = useSelector(selectUser, {
devModeChecks: { identityFunctionCheck: 'once' },
})
// ...
}
```
Expand Down
Loading