File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
packages/ra-core/src/controller/list Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -134,12 +134,20 @@ export const useListParams = ({
134134 }
135135 } , [ location . search ] ) ; // eslint-disable-line
136136
137+ const currentStoreKey = useRef ( storeKey ) ;
137138 // if the location includes params (for example from a link like
138139 // the categories products on the demo), we need to persist them in the
139140 // store as well so that we don't lose them after a redirection back
140141 // to the list
141142 useEffect (
142143 ( ) => {
144+ // If the storeKey has changed, ignore the first effect call. This avoids conflicts between lists sharing
145+ // the same resource but different storeKeys.
146+ if ( currentStoreKey . current !== storeKey ) {
147+ // storeKey has changed
148+ currentStoreKey . current = storeKey ;
149+ return ;
150+ }
143151 if ( disableSyncWithLocation ) {
144152 return ;
145153 }
@@ -150,6 +158,7 @@ export const useListParams = ({
150158 sort : sort . field ,
151159 order : sort . order ,
152160 } ;
161+
153162 if (
154163 // The location params are not empty (we don't want to override them if provided)
155164 Object . keys ( queryFromLocation ) . length > 0 ||
@@ -177,6 +186,7 @@ export const useListParams = ({
177186 sort ,
178187 query ,
179188 location . search ,
189+ params ,
180190 ]
181191 ) ;
182192
You can’t perform that action at this time.
0 commit comments