In my app, I use a <List> to list some resources.
What you were expecting:
In my previous version, 5.12.2, this worked without problems.
What happened instead:
Since upgrading to 5.13.0, it does not work anymore (code unchanged), due to the error "selectedIds.includes is not a function". However, the actual problem seems more deep because tracing the error, I found that selectedIds is not string[] | undefined, as it should be, but instead {storeKeys: string[]}. This is obviously not intended and probably indicates a bug in resolving objects from storage.
Steps to reproduce:
Related code:
Unfortunately, I have not been able to create a minimal example to replicate the issue despite some effort; it seems to happen only under specific circumstances. I try to describe them below as best as possible.
Other information:
Assume the bug happens in an element that is loaded at page A with url /pages/a.
- Strangely, it does not occur when I directly load that url (/pages/a) - then the list loads as expected!
- It only occurs when I first am at another page B (say /pages/b) and then navigate to /pages/a from there.
- It does not happen for all lists, just for certain ones. From what I can see, it does not depend on which children the list renders and also not on its filters or other params; in my case, just on the resource prop instead. (Note that the problem is not in the dataProvider though.)
- My best guess is that the error occurs if page B already triest to list the problematic resource X and then page A tries again.
- In my concrete case, page B contains a
<Datagrid> with resource Y. It lists without problems. However, for each row of Y, I list the associated X`s. That also works on B! But then, when navigating to A which just lists all X unconditionally, it breaks down.
- In the JS stack trace (see below), note the recursion.
Environment
- React-admin version: 5.13.0
- Last version that did not exhibit the issue (if applicable): 5.12.2
- React version: 19.2.0
- Browser: Firefox
- Stack trace (in case of a JS error):
TypeError: selectedIds.includes is not a function
areAllDataSelected SelectAllButton.tsx:77
SelectAllButton SelectAllButton.tsx:77
React
react_stack_bottom_frame
renderWithHooks
updateFunctionComponent
beginWork
runWithFiberInDEV
performUnitOfWork
workLoopSync
renderRootSync
performWorkOnRoot
performSyncWorkOnRoot
flushSyncWorkAcrossRoots_impl
processRootScheduleInMicrotask
scheduleImmediateRootScheduleTask
scheduleImmediateRootScheduleTask
ensureRootIsScheduled
scheduleUpdateOnFiber
forceStoreRerender
subscribeToStore
batchCalls notifyManager.ts:73
notifyFn notifyManager.ts:21
flush notifyManager.ts:44
flush notifyManager.ts:43
batchNotifyFn notifyManager.ts:24
flush notifyManager.ts:42
setTimeout handler*systemSetTimeoutZero timeoutManager.ts:134
flush notifyManager.ts:41
batch notifyManager.ts:60
#dispatch query.ts:677
setData query.ts:234
fetch query.ts:558
#executeFetch queryObserver.ts:343
onSubscribe queryObserver.ts:101
subscribe subscribable.ts:11
useBaseQuery useBaseQuery.ts:100
React
subscribeToStore
react_stack_bottom_frame
runWithFiberInDEV
commitHookEffectListMount
commitHookPassiveMountEffects
commitPassiveMountOnFiber
recursivelyTraversePassiveMountEffects
commitPassiveMountOnFiber
recursivelyTraversePassiveMountEffects
commitPassiveMountOnFiber
recursivelyTraversePassiveMountEffects
commitPassiveMountOnFiber
recursivelyTraversePassiveMountEffects
commitPassiveMountOnFiber
recursivelyTraversePassiveMountEffects
commitPassiveMountOnFiber
recursivelyTraversePassiveMountEffects
commitPassiveMountOnFiber
recursivelyTraversePassiveMountEffects
commitPassiveMountOnFiber
recursivelyTraversePassiveMountEffects
commitPassiveMountOnFiber
recursivelyTraversePassiveMountEffects
commitPassiveMountOnFiber
recursivelyTraversePassiveMountEffects
commitPassiveMountOnFiber
In my app, I use a
<List>to list some resources.What you were expecting:
In my previous version, 5.12.2, this worked without problems.
What happened instead:
Since upgrading to 5.13.0, it does not work anymore (code unchanged), due to the error "selectedIds.includes is not a function". However, the actual problem seems more deep because tracing the error, I found that
selectedIdsis notstring[] | undefined, as it should be, but instead{storeKeys: string[]}. This is obviously not intended and probably indicates a bug in resolving objects from storage.Steps to reproduce:
Related code:
Unfortunately, I have not been able to create a minimal example to replicate the issue despite some effort; it seems to happen only under specific circumstances. I try to describe them below as best as possible.
Other information:
Assume the bug happens in an element that is loaded at page A with url /pages/a.
<Datagrid>with resource Y. It lists without problems. However, for each row of Y, I list the associated X`s. That also works on B! But then, when navigating to A which just lists all X unconditionally, it breaks down.Environment
TypeError: selectedIds.includes is not a function
areAllDataSelected SelectAllButton.tsx:77
SelectAllButton SelectAllButton.tsx:77
React
react_stack_bottom_frame
renderWithHooks
updateFunctionComponent
beginWork
runWithFiberInDEV
performUnitOfWork
workLoopSync
renderRootSync
performWorkOnRoot
performSyncWorkOnRoot
flushSyncWorkAcrossRoots_impl
processRootScheduleInMicrotask
scheduleImmediateRootScheduleTask
scheduleImmediateRootScheduleTask
ensureRootIsScheduled
scheduleUpdateOnFiber
forceStoreRerender
subscribeToStore
batchCalls notifyManager.ts:73
notifyFn notifyManager.ts:21
flush notifyManager.ts:44
flush notifyManager.ts:43
batchNotifyFn notifyManager.ts:24
flush notifyManager.ts:42
setTimeout handler*systemSetTimeoutZero timeoutManager.ts:134
flush notifyManager.ts:41
batch notifyManager.ts:60
#dispatch query.ts:677
setData query.ts:234
fetch query.ts:558
#executeFetch queryObserver.ts:343
onSubscribe queryObserver.ts:101
subscribe subscribable.ts:11
useBaseQuery useBaseQuery.ts:100
React
subscribeToStore
react_stack_bottom_frame
runWithFiberInDEV
commitHookEffectListMount
commitHookPassiveMountEffects
commitPassiveMountOnFiber
recursivelyTraversePassiveMountEffects
commitPassiveMountOnFiber
recursivelyTraversePassiveMountEffects
commitPassiveMountOnFiber
recursivelyTraversePassiveMountEffects
commitPassiveMountOnFiber
recursivelyTraversePassiveMountEffects
commitPassiveMountOnFiber
recursivelyTraversePassiveMountEffects
commitPassiveMountOnFiber
recursivelyTraversePassiveMountEffects
commitPassiveMountOnFiber
recursivelyTraversePassiveMountEffects
commitPassiveMountOnFiber
recursivelyTraversePassiveMountEffects
commitPassiveMountOnFiber
recursivelyTraversePassiveMountEffects
commitPassiveMountOnFiber
recursivelyTraversePassiveMountEffects
commitPassiveMountOnFiber