File tree Expand file tree Collapse file tree
packages/query-core/src/__tests__ Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -380,6 +380,22 @@ describe('queryCache', () => {
380380 } )
381381 } )
382382
383+ describe ( 'QueryCache.remove' , ( ) => {
384+ it ( 'should only delete the instance currently stored under its queryHash' , ( ) => {
385+ const key = queryKey ( )
386+
387+ const staleQuery = queryCache . build ( queryClient , { queryKey : key } )
388+ queryCache . remove ( staleQuery )
389+
390+ const currentQuery = queryCache . build ( queryClient , { queryKey : key } )
391+ expect ( currentQuery ) . not . toBe ( staleQuery )
392+
393+ queryCache . remove ( staleQuery )
394+
395+ expect ( queryCache . get ( hashKey ( key ) ) ) . toBe ( currentQuery )
396+ } )
397+ } )
398+
383399 describe ( 'QueryCache.add' , ( ) => {
384400 it ( 'should not try to add a query already added to the cache' , async ( ) => {
385401 const key = queryKey ( )
You can’t perform that action at this time.
0 commit comments