Skip to content

Commit 530f015

Browse files
committed
update spelling from behaviour to behavior for more consistent docs
1 parent c91db2b commit 530f015

21 files changed

+35
-35
lines changed

docs/api/actionCreatorMiddleware.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ hide_title: true
1212
A custom middleware that detects if an action creator has been mistakenly dispatched, instead of being called before dispatching.
1313

1414
A common mistake is to call `dispatch(actionCreator)` instead of `dispatch(actionCreator())`.
15-
This tends to "work" as the action creator has the static `type` property, but can lead to unexpected behaviour.
15+
This tends to "work" as the action creator has the static `type` property, but can lead to unexpected behavior.
1616

1717
## Options
1818

docs/api/combineSlices.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ const reducerWithUser = rootReducer.inject(userSlice, {
213213
```
214214

215215
This may be useful for hot reload, or "removing" a reducer by replacing it with a function that always returns `null`.
216-
Note that for predictable behaviour, your types should account for all of the possible reducers you intend to occupy a path.
216+
Note that for predictable behavior, your types should account for all of the possible reducers you intend to occupy a path.
217217

218218
```ts no-transpile title="'Removing' a reducer, by replacing it with a no-op function"
219219
declare module '.' {

docs/rtk-query/api/created-api/hooks.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ type UseQuerySubscriptionResult = {
460460
461461
- `arg`: The argument passed to the query defined in the endpoint.
462462
You can also pass in `skipToken` here as an alternative way of skipping the query, see [skipToken](#skiptoken)
463-
- `options`: A set of options that control the fetching behaviour of the hook
463+
- `options`: A set of options that control the fetching behavior of the hook
464464
465465
- **Returns**
466466
- An object containing a function to `refetch` the data

docs/rtk-query/usage/automated-refetching.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ By declaring these tags as what can possibly be provided to the cache, it enable
108108

109109
### Providing cache data
110110

111-
Each individual `query` endpoint can have its cached data _provide_ particular tags. Doing so enables a relationship between cached data from one or more query endpoints and the behaviour of one or more mutation endpoints.
111+
Each individual `query` endpoint can have its cached data _provide_ particular tags. Doing so enables a relationship between cached data from one or more query endpoints and the behavior of one or more mutation endpoints.
112112

113113
The `providesTags` property on a `query` endpoint is used for this purpose.
114114

@@ -237,7 +237,7 @@ In order to provide stronger control over invalidating the appropriate data, you
237237

238238
### Invalidating cache data
239239

240-
Each individual mutation endpoint can `invalidate` particular tags for existing cached data. Doing so enables a relationship between cached data from one or more query endpoints and the behaviour of one or more mutation endpoints.
240+
Each individual mutation endpoint can `invalidate` particular tags for existing cached data. Doing so enables a relationship between cached data from one or more query endpoints and the behavior of one or more mutation endpoints.
241241

242242
The `invalidatesTags` property on a mutation endpoint is used for this purpose.
243243

@@ -621,7 +621,7 @@ A powerful use-case is to use an ID like `'LIST'` as a label for data provided b
621621
622622
:::
623623
624-
We can compare the scenarios below to see how using a `'LIST'` id can be leveraged to optimize behaviour.
624+
We can compare the scenarios below to see how using a `'LIST'` id can be leveraged to optimize behavior.
625625
626626
#### Invalidating everything of a type
627627
@@ -774,7 +774,7 @@ If you intend for the `addPost` mutation to refresh all posts including individu
774774

775775
The information provided to the cache is not limited to successful data fetches. The concept can be used to inform RTK Query that when a particular failure has been encountered, to `provide` a specific `tag` for that failed cache data. A separate endpoint can then `invalidate` the data for that `tag`, telling RTK Query to re-attempt the previously failed endpoints if a component is still subscribed to the failed data.
776776

777-
The example below demonstrates an example with the following behaviour:
777+
The example below demonstrates an example with the following behavior:
778778

779779
- Provides an `UNAUTHORIZED` cache tag if a query fails with an error code of `401 UNAUTHORIZED`
780780
- Provides an `UNKNOWN_ERROR` cache tag if a query fails with a different error

docs/rtk-query/usage/cache-behavior.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ description: 'RTK Query > Usage > Cache Behavior: defaults, cache lifetimes, and
1212

1313
A key feature of RTK Query is its management of cached data. When data is fetched from the server, RTK Query will store the data in the Redux store as a 'cache'. When an additional request is performed for the same data, RTK Query will provide the existing cached data rather than sending an additional request to the server.
1414

15-
RTK Query provides a number of concepts and tools to manipulate the cache behaviour and adjust it to your needs.
15+
RTK Query provides a number of concepts and tools to manipulate the cache behavior and adjust it to your needs.
1616

1717
## Default Cache Behavior
1818

@@ -73,7 +73,7 @@ If 'ComponentThree' is unmounted in the example above, regardless of how much ti
7373

7474
## Manipulating Cache Behavior
7575

76-
On top of the default behaviour, RTK Query provides a number of methods to re-fetch data earlier in scenarios where it should be considered invalid, or is otherwise deemed suitable to be 'refreshed'.
76+
On top of the default behavior, RTK Query provides a number of methods to re-fetch data earlier in scenarios where it should be considered invalid, or is otherwise deemed suitable to be 'refreshed'.
7777

7878
### Reducing subscription time with `keepUnusedDataFor`
7979

docs/rtk-query/usage/customizing-queries.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ The default method to handle queries is via the [`baseQuery`](../api/createApi#b
1818

1919
To process queries, endpoints are defined with a [`query`](../api/createApi.mdx#query) option, which passes its return value to a common [`baseQuery`](../api/createApi#basequery) function used for the API.
2020

21-
By default, RTK Query ships with [`fetchBaseQuery`](../api/fetchBaseQuery), which is a lightweight [`fetch`](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) wrapper that automatically handles request headers and response parsing in a manner similar to common libraries like `axios`. If `fetchBaseQuery` alone does not meet your needs, you can customize its behaviour with a wrapper function, or create your own [`baseQuery`](../api/createApi.mdx#basequery) function from scratch for [`createApi`](../api/createApi) to use.
21+
By default, RTK Query ships with [`fetchBaseQuery`](../api/fetchBaseQuery), which is a lightweight [`fetch`](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) wrapper that automatically handles request headers and response parsing in a manner similar to common libraries like `axios`. If `fetchBaseQuery` alone does not meet your needs, you can customize its behavior with a wrapper function, or create your own [`baseQuery`](../api/createApi.mdx#basequery) function from scratch for [`createApi`](../api/createApi) to use.
2222

2323
See also [`baseQuery API Reference`](../api/createApi.mdx#basequery).
2424

@@ -263,15 +263,15 @@ RTK Query comes with `fetchBaseQuery` out of the box, which makes it straightfor
263263

264264
RTK Query supports defining endpoints that run arbitrary async logic and return a result. Individual endpoints on [`createApi`](../api/createApi.mdx) accept a [`queryFn`](../api/createApi.mdx#queryfn) property, which let you write your own async function with whatever logic you want inside.
265265

266-
This can be useful for scenarios where you want to have particularly different behaviour for a single endpoint, or where the query itself is not relevant, including:
266+
This can be useful for scenarios where you want to have particularly different behavior for a single endpoint, or where the query itself is not relevant, including:
267267

268268
- One-off queries that use a different base URL
269269
- One-off queries that use different request handling, such as automatic re-tries
270-
- One-off queries that use different error handling behaviour
270+
- One-off queries that use different error handling behavior
271271
- Queries that make requests using a third-party library SDK, such as Firebase or Supabase
272272
- Queries that perform async tasks that are not a typical request/response
273273
- Performing multiple requests with a single query ([example](#performing-multiple-requests-with-a-single-query))
274-
- Leveraging invalidation behaviour with no relevant query ([example](#using-a-no-op-queryfn))
274+
- Leveraging invalidation behavior with no relevant query ([example](#using-a-no-op-queryfn))
275275
- Using [Streaming Updates](./streaming-updates) with no relevant initial request ([example](#streaming-data-with-no-initial-request))
276276

277277
See also [`queryFn API Reference`](../api/createApi.mdx#queryfn) for the type signature and available options.
@@ -1015,7 +1015,7 @@ const api = createApi({
10151015
refetchPostsAndUsers: build.mutation<null, void>({
10161016
// The query is not relevant here, so a `null` returning `queryFn` is used
10171017
queryFn: () => ({ data: null }),
1018-
// This mutation takes advantage of tag invalidation behaviour to trigger
1018+
// This mutation takes advantage of tag invalidation behavior to trigger
10191019
// any queries that provide the 'Post' or 'User' tags to re-fetch if the queries
10201020
// are currently subscribed to the cached data
10211021
invalidatesTags: ['Post', 'User'],

docs/rtk-query/usage/migrating-to-rtk-query.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ The most common use case for side effects in Redux apps is fetching data. Redux
2222

2323
RTK Query is purpose-built to solve the use case of data fetching. While it can't replace all of the situations where you'd use thunks or other side effects approaches, **using RTK Query should eliminate the need for most of that hand-written side effects logic**.
2424

25-
RTK Query is expected to cover a lot of overlapping behaviour that users may have previously used `createAsyncThunk` for, including caching purposes, and request lifecycle management (e.g. `isUninitialized`, `isLoading`, `isError` states).
25+
RTK Query is expected to cover a lot of overlapping behavior that users may have previously used `createAsyncThunk` for, including caching purposes, and request lifecycle management (e.g. `isUninitialized`, `isLoading`, `isError` states).
2626

2727
In order to migrate data-fetching features from existing Redux tools to RTK Query, the appropriate endpoints should be added to an RTK Query API slice, and the previous feature code deleted. This generally will not include much common code kept between the two, as the tools work differently and one will replace the other.
2828

@@ -271,7 +271,7 @@ export function useGetPokemonByNameQuery(name: string) {
271271

272272
Our code above meets all of the design specifications, so let's use it! Below we can see how the hook can be called in a component, and return the relevant data & status booleans.
273273

274-
Our implementation below provides the following behaviour in the component:
274+
Our implementation below provides the following behavior in the component:
275275

276276
- When our component is mounted, if a request for the provided pokemon name has not already been sent for the session, send the request off
277277
- The hook always provides the latest received `data` when available, as well as the request status booleans `isUninitialized`, `isPending`, `isFulfilled` & `isRejected` in order to determine the current UI at any given moment as a function of our state.

docs/rtk-query/usage/persistence-and-rehydration.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ See also [Server Side Rendering](./server-side-rendering.mdx).
2121

2222
Generally, persisting API slices is not recommended and instead, mechanisms like
2323
[`Cache-Control` Headers](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control)
24-
should be used in browsers to define cache behaviour.
24+
should be used in browsers to define cache behavior.
2525
Persisting and rehydrating an api slice might always leave the user with very stale data if the user
2626
has not visited the page for some time.
2727
Nonetheless, in environments like Native Apps, where there is no browser cache to take care of this,

docs/rtk-query/usage/queries.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ function PostsList() {
330330
}
331331
```
332332

333-
To summarize the above behaviour - the returned values must be correctly memoized. See also [Deriving Data with Selectors](https://redux.js.org/usage/deriving-data-selectors) and [Redux Essentials - RTK Query Advanced Patterns](https://redux.js.org/tutorials/essentials/part-8-rtk-query-advanced#selecting-values-from-results) for additional information.
333+
To summarize the above behavior - the returned values must be correctly memoized. See also [Deriving Data with Selectors](https://redux.js.org/usage/deriving-data-selectors) and [Redux Essentials - RTK Query Advanced Patterns](https://redux.js.org/tutorials/essentials/part-8-rtk-query-advanced#selecting-values-from-results) for additional information.
334334

335335
### Avoiding unnecessary requests
336336

docs/rtk-query/usage/usage-without-react-hooks.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ The `endpoint.select(arg)` function creates a _new_ selector instance - it isn't
5555

5656
:::
5757

58-
With React hooks, this behaviour is instead handled within [`useQuery`](../api/created-api/hooks.mdx#usequery), [`useQueryState`](../api/created-api/hooks.mdx#usequerystate), and [`useLazyQuery`](../api/created-api/hooks.mdx#uselazyquery).
58+
With React hooks, this behavior is instead handled within [`useQuery`](../api/created-api/hooks.mdx#usequery), [`useQueryState`](../api/created-api/hooks.mdx#usequerystate), and [`useLazyQuery`](../api/created-api/hooks.mdx#uselazyquery).
5959

6060
```ts title="Accessing cached data & request status" no-transpile
6161
const result = api.endpoints.getPosts.select()(state)

docs/usage/migrating-rtk-2.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ The standalone version of `getDefaultMiddleware` has been deprecated since v1.6.
295295

296296
We have also removed the `getType` export, which was used to extract a type string from action creators made with `createAction`. Instead, use the static property `actionCreator.type`.
297297

298-
#### RTK Query behaviour changes
298+
#### RTK Query behavior changes
299299

300300
We've had a number of reports where RTK Query had issues around usage of `dispatch(endpoint.initiate(arg, {subscription: false}))`. There were also reports that multiple triggered lazy queries were resolving the promises at the wrong time. Both of these had the same underlying issue, which was that RTKQ wasn't tracking cache entries in these cases (intentionally). We've reworked the logic to always track cache entries (and remove them as needed), which should resolve those behavior issues.
301301

@@ -462,7 +462,7 @@ export const useDispatch = createDispatchHook(context).withTypes<AppDispatch>()
462462
export const useSelector = createSelectorHook(context).withTypes<RootState>()
463463
```
464464

465-
In v9, the types now match the runtime behaviour. The context is typed to hold `ReactReduxContextValue | null`, and the hooks know that if they receive `null` they'll throw an error so it doesn't affect the return type.
465+
In v9, the types now match the runtime behavior. The context is typed to hold `ReactReduxContextValue | null`, and the hooks know that if they receive `null` they'll throw an error so it doesn't affect the return type.
466466

467467
The above example now becomes:
468468

@@ -899,7 +899,7 @@ yield takeEvery(todoAdded.type, saga)
899899

900900
With the addition of the [callback syntax for createSlice](#callback-syntax-for-createslicereducers), the [suggestion](https://github.com/reduxjs/redux-toolkit/issues/3837) was made to enable custom slice reducer creators. These creators would be able to:
901901

902-
- Modify reducer behaviour by adding case or matcher reducers
902+
- Modify reducer behavior by adding case or matcher reducers
903903
- Attach actions (or any other useful functions) to `slice.actions`
904904
- Attach provided case reducers to `slice.caseReducers`
905905

examples/query/react/graphql-codegen/.introspection.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1775,13 +1775,13 @@
17751775
},
17761776
{
17771777
"name": "specifiedBy",
1778-
"description": "Exposes a URL that specifies the behaviour of this scalar.",
1778+
"description": "Exposes a URL that specifies the behavior of this scalar.",
17791779
"isRepeatable": false,
17801780
"locations": ["SCALAR"],
17811781
"args": [
17821782
{
17831783
"name": "url",
1784-
"description": "The URL that specifies the behaviour of this scalar.",
1784+
"description": "The URL that specifies the behavior of this scalar.",
17851785
"type": {
17861786
"kind": "NON_NULL",
17871787
"name": null,

packages/toolkit/src/query/tests/buildHooks.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2666,7 +2666,7 @@ describe('hooks with createApi defaults set', () => {
26662666
})
26672667
})
26682668

2669-
describe('skip behaviour', () => {
2669+
describe('skip behavior', () => {
26702670
const uninitialized = {
26712671
status: QueryStatus.uninitialized,
26722672
refetch: expect.any(Function),

packages/toolkit/src/query/tests/cleanup.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// tests for "cleanup-after-unsubscribe" behaviour
1+
// tests for "cleanup-after-unsubscribe" behavior
22
import React from 'react'
33

44
import { createListenerMiddleware } from '@reduxjs/toolkit'

packages/toolkit/src/query/tests/createApi.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ describe('endpoint definition typings', () => {
335335
api = getNewApi()
336336
})
337337

338-
test('pre-modification behaviour', async () => {
338+
test('pre-modification behavior', async () => {
339339
const storeRef = setupApiStore(api, undefined, {
340340
withoutTestLifecycles: true,
341341
})

packages/toolkit/src/query/tests/devWarnings.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ describe('missing reducer', () => {
130130
await store.dispatch(api1.endpoints.q1.initiate(undefined))
131131
})
132132

133-
test(`warning behaviour`, () => {
133+
test(`warning behavior`, () => {
134134
const store = configureStore({
135135
reducer: { x: () => 0 },
136136
// @ts-expect-error

packages/toolkit/src/query/tests/invalidation.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ type Tags = TagDescription<TagTypes>[]
1919
/** providesTags, invalidatesTags, shouldInvalidate */
2020
const caseMatrix: [Tags, Tags, boolean][] = [
2121
// *****************************
22-
// basic invalidation behaviour
22+
// basic invalidation behavior
2323
// *****************************
2424

2525
// string

packages/toolkit/src/query/tests/optimisticUpserts.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ describe('upsertQueryData', () => {
235235
.mockResolvedValueOnce(42)
236236

237237
// a subscriber is needed to have the data stay in the cache
238-
// Not sure if this is the wanted behaviour, I would have liked
238+
// Not sure if this is the wanted behavior, I would have liked
239239
// it to stay in the cache for the x amount of time the cache
240240
// is preserved normally after the last subscriber was unmounted
241241
const { result, rerender } = renderHook(

packages/toolkit/src/tests/createAsyncThunk.test-d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ describe('type tests', () => {
290290

291291
test('one argument, specified as optional number: asyncThunk has optional number argument', () => {
292292
// this test will fail with strictNullChecks: false, that is to be expected
293-
// in that case, we have to forbid this behaviour or it will make arguments optional everywhere
293+
// in that case, we have to forbid this behavior or it will make arguments optional everywhere
294294
const asyncThunk = createAsyncThunk('test', (arg?: number) => 0)
295295

296296
// Per https://github.com/reduxjs/redux-toolkit/issues/3758#issuecomment-1742152774 , this is a bug in
@@ -317,7 +317,7 @@ describe('type tests', () => {
317317

318318
test('one argument, specified as number|undefined: asyncThunk has optional number argument', () => {
319319
// this test will fail with strictNullChecks: false, that is to be expected
320-
// in that case, we have to forbid this behaviour or it will make arguments optional everywhere
320+
// in that case, we have to forbid this behavior or it will make arguments optional everywhere
321321
const asyncThunk = createAsyncThunk(
322322
'test',
323323
(arg: number | undefined) => 0,
@@ -414,7 +414,7 @@ describe('type tests', () => {
414414

415415
test('two arguments, first specified as number|undefined: asyncThunk has optional number argument', () => {
416416
// this test will fail with strictNullChecks: false, that is to be expected
417-
// in that case, we have to forbid this behaviour or it will make arguments optional everywhere
417+
// in that case, we have to forbid this behavior or it will make arguments optional everywhere
418418
const asyncThunk = createAsyncThunk(
419419
'test',
420420
(arg: number | undefined, thunkApi) => 0,

packages/toolkit/src/tests/createAsyncThunk.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ describe('createAsyncThunk with abortController', () => {
495495
})
496496
})
497497

498-
describe('behaviour with missing AbortController', () => {
498+
describe('behavior with missing AbortController', () => {
499499
let keepAbortController: (typeof window)['AbortController']
500500
let freshlyLoadedModule: typeof import('../createAsyncThunk')
501501
let restore: () => void = () => {}

packages/toolkit/src/tests/createSlice.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ describe('createSlice', () => {
294294
})
295295
})
296296

297-
describe('behaviour with enhanced case reducers', () => {
297+
describe('behavior with enhanced case reducers', () => {
298298
it('should pass all arguments to the prepare function', () => {
299299
const prepare = vi.fn((payload, somethingElse) => ({ payload }))
300300

0 commit comments

Comments
 (0)