File tree Expand file tree Collapse file tree 1 file changed +11
-11
lines changed
packages/toolkit/src/query/core/buildMiddleware Expand file tree Collapse file tree 1 file changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -70,18 +70,18 @@ export const build: SubMiddlewareBuilder = ({
7070 const valuesArray = Array . from ( toInvalidate . values ( ) )
7171 for ( const { queryCacheKey } of valuesArray ) {
7272 const querySubState = state . queries [ queryCacheKey ]
73- const subscriptionSubState = state . subscriptions [ queryCacheKey ] || { }
73+ const subscriptionSubState = state . subscriptions [ queryCacheKey ] ?? { }
7474
75- if ( ! querySubState ) continue
76-
77- if ( Object . keys ( subscriptionSubState ) . length === 0 ) {
78- mwApi . dispatch (
79- removeQueryResult ( {
80- queryCacheKey : queryCacheKey as QueryCacheKey ,
81- } )
82- )
83- } else if ( querySubState . status !== QueryStatus . uninitialized ) {
84- mwApi . dispatch ( refetchQuery ( querySubState , queryCacheKey ) )
75+ if ( querySubState ) {
76+ if ( Object . keys ( subscriptionSubState ) . length === 0 ) {
77+ mwApi . dispatch (
78+ removeQueryResult ( {
79+ queryCacheKey : queryCacheKey as QueryCacheKey ,
80+ } )
81+ )
82+ } else if ( querySubState . status !== QueryStatus . uninitialized ) {
83+ mwApi . dispatch ( refetchQuery ( querySubState , queryCacheKey ) )
84+ }
8585 }
8686 }
8787 } )
You can’t perform that action at this time.
0 commit comments