Skip to content

Commit 147ac5b

Browse files
committed
Apply review suggestions
1 parent 9f9b365 commit 147ac5b

File tree

9 files changed

+38
-38
lines changed

9 files changed

+38
-38
lines changed

docs/useSubscribeToRecordList.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,25 +26,25 @@ import { useNotify, useListContext } from 'react-admin';
2626
import { useSubscribeToRecordList } from '@react-admin/ra-realtime';
2727

2828
const ListWatcher = () => {
29-
const notity = useNotify();
29+
const notify = useNotify();
3030
const { refetch, data } = useListContext();
3131
useSubscribeToRecordList(event => {
3232
switch (event.type) {
3333
case 'created': {
34-
notity('New movie created');
34+
notify('New movie created');
3535
refetch();
3636
break;
3737
}
3838
case 'updated': {
3939
if (data.find(record => record.id === event.payload.ids[0])) {
40-
notity(`Movie #${event.payload.ids[0]} updated`);
40+
notify(`Movie #${event.payload.ids[0]} updated`);
4141
refetch();
4242
}
4343
break;
4444
}
4545
case 'deleted': {
4646
if (data.find(record => record.id === event.payload.ids[0])) {
47-
notity(`Movie #${event.payload.ids[0]} deleted`);
47+
notify(`Movie #${event.payload.ids[0]} deleted`);
4848
refetch();
4949
}
5050
break;
@@ -80,25 +80,25 @@ const MovieList = () => (
8080
Whenever an event is published on the `resource/[resource]` topic, the function passed as the first argument will be called with the event as a parameter.
8181

8282
```jsx
83-
const notity = useNotify();
83+
const notify = useNotify();
8484
const { refetch, data } = useListContext();
8585
useSubscribeToRecordList(event => {
8686
switch (event.type) {
8787
case 'created': {
88-
notity('New movie created');
88+
notify('New movie created');
8989
refetch();
9090
break;
9191
}
9292
case 'updated': {
9393
if (data.find(record => record.id === event.payload.ids[0])) {
94-
notity(`Movie #${event.payload.ids[0]} updated`);
94+
notify(`Movie #${event.payload.ids[0]} updated`);
9595
refetch();
9696
}
9797
break;
9898
}
9999
case 'deleted': {
100100
if (data.find(record => record.id === event.payload.ids[0])) {
101-
notity(`Movie #${event.payload.ids[0]} deleted`);
101+
notify(`Movie #${event.payload.ids[0]} deleted`);
102102
refetch();
103103
}
104104
break;
@@ -110,33 +110,33 @@ useSubscribeToRecordList(event => {
110110
**Tip**: Memoize the callback using `useCallback` to avoid unnecessary subscriptions/unsubscriptions.
111111

112112
```jsx
113-
const notity = useNotify();
113+
const notify = useNotify();
114114
const { refetch, data } = useListContext();
115115
const callback = useCallback(
116116
event => {
117117
switch (event.type) {
118118
case 'created': {
119-
notity('New movie created');
119+
notify('New movie created');
120120
refetch();
121121
break;
122122
}
123123
case 'updated': {
124124
if (data.find(record => record.id === event.payload.ids[0])) {
125-
notity(`Movie #${event.payload.ids[0]} updated`);
125+
notify(`Movie #${event.payload.ids[0]} updated`);
126126
refetch();
127127
}
128128
break;
129129
}
130130
case 'deleted': {
131131
if (data.find(record => record.id === event.payload.ids[0])) {
132-
notity(`Movie #${event.payload.ids[0]} deleted`);
132+
notify(`Movie #${event.payload.ids[0]} deleted`);
133133
refetch();
134134
}
135135
break;
136136
}
137137
}
138138
},
139-
[data, refetch, notity]
139+
[data, refetch, notify]
140140
);
141141
useSubscribeToRecordList(callback);
142142
```

docs_headless/astro.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ export default defineConfig({
271271
*/
272272
function enterpriseEntry(name) {
273273
return {
274-
link: name.toLowerCase().replace(/</g, '').replace(/>/g, ''),
274+
link: `${name.toLowerCase().replace(/</g, '').replace(/>/g, '')}/`,
275275
label: name,
276276
attrs: { class: 'enterprise' },
277277
badge: {

docs_headless/src/content/docs/LockStatusBase.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,4 +81,4 @@ export const LockStatus = () => {
8181
};
8282
```
8383

84-
In addition to the [`useLockCallbacks`](#uselockcallbacks) parameters, `<LockStatusBase>` accepts a `render` prop. The function passed to the `render` prop will be called with the result of the `useLockCallbacks` hook.
84+
In addition to the [`useLockCallbacks`](./useLockCallbacks.md) parameters, `<LockStatusBase>` accepts a `render` prop. The function passed to the `render` prop will be called with the result of the `useLockCallbacks` hook.

docs_headless/src/content/docs/canAccessWithPermissions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ This function takes an object as argument with the following fields:
6565
| `resource` | Required | `string` | The resource for which to check users has the execution right
6666
| `record` | Required | `string` | The record for which to check users has the execution right
6767

68-
`canAccessWithPermissions` expects the `permissions` to be a flat array of permissions. It is your responsibility to fetch these permissions (usually during login). If the permissions are spread into several role definitions, you can merge them into a single array using the [`getPermissionsFromRoles`](#getpermissionsfromroles) function.
68+
`canAccessWithPermissions` expects the `permissions` to be a flat array of permissions. It is your responsibility to fetch these permissions (usually during login). If the permissions are spread into several role definitions, you can merge them into a single array using the [`getPermissionsFromRoles`](./getPermissionsFromRoles.md) function.
6969

7070
## Building RBAC
7171

docs_headless/src/content/docs/getPermissionsFromRoles.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import { getPermissionsFromRoles } from '@react-admin/ra-core-ee';
2828
// static role definitions (usually in the app code)
2929
const roleDefinitions = {
3030
admin: [
31-
{ action: '*', resource: '*' }
31+
{ action: '*', resource: '*' },
3232
],
3333
reader: [
3434
{ action: ['list', 'show', 'export'], resource: '*' },
@@ -77,12 +77,12 @@ The `authProvider` stores the permissions in `localStorage`, so that returning u
7777
// in roleDefinitions.ts
7878
export const roleDefinitions = {
7979
admin: [
80-
{ action: '*', resource: '*' }
80+
{ action: '*', resource: '*' },
8181
],
8282
reader: [
83-
{ action: ['list', 'show', 'export'], resource: '*' }
84-
{ action: 'read', resource: 'posts.*' }
85-
{ action: 'read', resource: 'comments.*' }
83+
{ action: ['list', 'show', 'export'], resource: '*' },
84+
{ action: 'read', resource: 'posts.*' },
85+
{ action: 'read', resource: 'comments.*' },
8686
],
8787
accounting: [
8888
{ action: '*', resource: 'sales' },

docs_headless/src/content/docs/useGetListLive.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@ const LatestNews = () => {
3333

3434
The hook will subscribe to live updates on the list of records (topic: `resource/[resource]`) and will refetch the list when a new record is created, or an existing record is updated or deleted.
3535

36-
See the [useGetList](https://marmelab.com/react-admin/useGetList.html) documentation for the full list of parameters and return type.
36+
See the [useGetList](./useGetList.md) documentation for the full list of parameters and return type.

docs_headless/src/content/docs/useGetLock.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const FormToolbar = () => {
3939
<button type="submit" disabled={isLockedByOtherUser}>Save</button>
4040
{isLockedByOtherUser && (
4141
<span>
42-
{`This record is locked by another user: ${lock?.dentity}.`}
42+
{`This record is locked by another user: ${lock?.identity}.`}
4343
</span>
4444
)}
4545
</div>

docs_headless/src/content/docs/useGetOneLive.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ const UserProfile = () => {
2727

2828
The hook will subscribe to live updates on the record (topic: `resource/[resource]/[id]`) and will refetch the record when it is updated or deleted.
2929

30-
See the [useGetOne](https://marmelab.com/react-admin/useGetOne.html) documentation for the full list of parameters and return type.
30+
See the [useGetOne](./useGetOne.md) documentation for the full list of parameters and return type.

docs_headless/src/content/docs/useSubscribeToRecordList.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,25 +23,25 @@ import { useNotify, useListContext } from 'ra-core';
2323
import { useSubscribeToRecordList } from '@react-admin/ra-core-ee';
2424

2525
const ListWatcher = () => {
26-
const notity = useNotify();
26+
const notify = useNotify();
2727
const { refetch, data } = useListContext();
2828
useSubscribeToRecordList(event => {
2929
switch (event.type) {
3030
case 'created': {
31-
notity('New movie created');
31+
notify('New movie created');
3232
refetch();
3333
break;
3434
}
3535
case 'updated': {
3636
if (data.find(record => record.id === event.payload.ids[0])) {
37-
notity(`Movie #${event.payload.ids[0]} updated`);
37+
notify(`Movie #${event.payload.ids[0]} updated`);
3838
refetch();
3939
}
4040
break;
4141
}
4242
case 'deleted': {
4343
if (data.find(record => record.id === event.payload.ids[0])) {
44-
notity(`Movie #${event.payload.ids[0]} deleted`);
44+
notify(`Movie #${event.payload.ids[0]} deleted`);
4545
refetch();
4646
}
4747
break;
@@ -72,25 +72,25 @@ const MovieList = () => (
7272
Whenever an event is published on the `resource/[resource]` topic, the function passed as the first argument will be called with the event as a parameter.
7373

7474
```tsx
75-
const notity = useNotify();
75+
const notify = useNotify();
7676
const { refetch, data } = useListContext();
7777
useSubscribeToRecordList(event => {
7878
switch (event.type) {
7979
case 'created': {
80-
notity('New movie created');
80+
notify('New movie created');
8181
refetch();
8282
break;
8383
}
8484
case 'updated': {
8585
if (data.find(record => record.id === event.payload.ids[0])) {
86-
notity(`Movie #${event.payload.ids[0]} updated`);
86+
notify(`Movie #${event.payload.ids[0]} updated`);
8787
refetch();
8888
}
8989
break;
9090
}
9191
case 'deleted': {
9292
if (data.find(record => record.id === event.payload.ids[0])) {
93-
notity(`Movie #${event.payload.ids[0]} deleted`);
93+
notify(`Movie #${event.payload.ids[0]} deleted`);
9494
refetch();
9595
}
9696
break;
@@ -102,33 +102,33 @@ useSubscribeToRecordList(event => {
102102
**Tip**: Memoize the callback using `useCallback` to avoid unnecessary subscriptions/unsubscriptions.
103103

104104
```tsx
105-
const notity = useNotify();
105+
const notify = useNotify();
106106
const { refetch, data } = useListContext();
107107
const callback = useCallback(
108108
event => {
109109
switch (event.type) {
110110
case 'created': {
111-
notity('New movie created');
111+
notify('New movie created');
112112
refetch();
113113
break;
114114
}
115115
case 'updated': {
116116
if (data.find(record => record.id === event.payload.ids[0])) {
117-
notity(`Movie #${event.payload.ids[0]} updated`);
117+
notify(`Movie #${event.payload.ids[0]} updated`);
118118
refetch();
119119
}
120120
break;
121121
}
122122
case 'deleted': {
123123
if (data.find(record => record.id === event.payload.ids[0])) {
124-
notity(`Movie #${event.payload.ids[0]} deleted`);
124+
notify(`Movie #${event.payload.ids[0]} deleted`);
125125
refetch();
126126
}
127127
break;
128128
}
129129
}
130130
},
131-
[data, refetch, notity]
131+
[data, refetch, notify]
132132
);
133133
useSubscribeToRecordList(callback);
134134
```
@@ -143,7 +143,7 @@ The `options` object can contain the following properties:
143143
- `once`: Whether to unsubscribe after the first event. Defaults to `false`.
144144
- `unsubscribeOnUnmount`: Whether to unsubscribe on unmount. Defaults to `true`.
145145

146-
See [`useSubscribe`](#usesubscribe) for more details.
146+
See [`useSubscribe`](./useSubscribe.md) for more details.
147147

148148
## `resource`
149149

0 commit comments

Comments
 (0)