@tanstack/query-core 5.0.0-alpha.85 → 5.0.0-alpha.87
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/legacy/focusManager.cjs +116 -0
- package/build/legacy/focusManager.cjs.map +1 -0
- package/build/legacy/focusManager.d.cts +16 -0
- package/build/{lib → legacy}/focusManager.d.ts +6 -5
- package/build/legacy/focusManager.js +91 -0
- package/build/legacy/focusManager.js.map +1 -0
- package/build/legacy/hydration.cjs +109 -0
- package/build/legacy/hydration.cjs.map +1 -0
- package/build/legacy/hydration.d.cts +35 -0
- package/build/legacy/hydration.d.ts +35 -0
- package/build/legacy/hydration.js +82 -0
- package/build/legacy/hydration.js.map +1 -0
- package/build/legacy/index.cjs +85 -0
- package/build/legacy/index.cjs.map +1 -0
- package/build/legacy/index.d.cts +9 -0
- package/build/legacy/index.d.ts +9 -0
- package/build/legacy/index.js +50 -0
- package/build/legacy/index.js.map +1 -0
- package/build/legacy/infiniteQueryBehavior.cjs +141 -0
- package/build/legacy/infiniteQueryBehavior.cjs.map +1 -0
- package/build/legacy/infiniteQueryBehavior.d.cts +15 -0
- package/build/legacy/infiniteQueryBehavior.d.ts +15 -0
- package/build/legacy/infiniteQueryBehavior.js +115 -0
- package/build/legacy/infiniteQueryBehavior.js.map +1 -0
- package/build/legacy/infiniteQueryObserver.cjs +88 -0
- package/build/legacy/infiniteQueryObserver.cjs.map +1 -0
- package/build/legacy/infiniteQueryObserver.d.cts +19 -0
- package/build/{lib → legacy}/infiniteQueryObserver.d.ts +7 -8
- package/build/{lib/infiniteQueryObserver.legacy.js → legacy/infiniteQueryObserver.js} +24 -32
- package/build/legacy/infiniteQueryObserver.js.map +1 -0
- package/build/legacy/mutation.cjs +297 -0
- package/build/legacy/mutation.cjs.map +1 -0
- package/build/legacy/mutation.d.cts +3 -0
- package/build/legacy/mutation.d.ts +3 -0
- package/build/legacy/mutation.js +272 -0
- package/build/legacy/mutation.js.map +1 -0
- package/build/legacy/mutationCache.cjs +133 -0
- package/build/legacy/mutationCache.cjs.map +1 -0
- package/build/legacy/mutationCache.d.cts +3 -0
- package/build/legacy/mutationCache.d.ts +3 -0
- package/build/legacy/mutationCache.js +109 -0
- package/build/legacy/mutationCache.js.map +1 -0
- package/build/legacy/mutationObserver.cjs +171 -0
- package/build/legacy/mutationObserver.cjs.map +1 -0
- package/build/legacy/mutationObserver.d.cts +3 -0
- package/build/legacy/mutationObserver.d.ts +3 -0
- package/build/legacy/mutationObserver.js +147 -0
- package/build/legacy/mutationObserver.js.map +1 -0
- package/build/legacy/notifyManager.cjs +97 -0
- package/build/legacy/notifyManager.cjs.map +1 -0
- package/build/legacy/notifyManager.d.cts +20 -0
- package/build/{lib → legacy}/notifyManager.d.ts +4 -4
- package/build/{lib → legacy}/notifyManager.js +14 -31
- package/build/legacy/notifyManager.js.map +1 -0
- package/build/legacy/onlineManager.cjs +106 -0
- package/build/legacy/onlineManager.cjs.map +1 -0
- package/build/legacy/onlineManager.d.cts +16 -0
- package/build/legacy/onlineManager.d.ts +16 -0
- package/build/legacy/onlineManager.js +81 -0
- package/build/legacy/onlineManager.js.map +1 -0
- package/build/legacy/queriesObserver.cjs +242 -0
- package/build/legacy/queriesObserver.cjs.map +1 -0
- package/build/legacy/queriesObserver.d.cts +26 -0
- package/build/{lib → legacy}/queriesObserver.d.ts +10 -11
- package/build/legacy/queriesObserver.js +218 -0
- package/build/legacy/queriesObserver.js.map +1 -0
- package/build/legacy/query.cjs +423 -0
- package/build/legacy/query.cjs.map +1 -0
- package/build/legacy/query.d.cts +3 -0
- package/build/legacy/query.d.ts +3 -0
- package/build/legacy/query.js +399 -0
- package/build/legacy/query.js.map +1 -0
- package/build/legacy/queryCache.cjs +140 -0
- package/build/legacy/queryCache.cjs.map +1 -0
- package/build/legacy/queryCache.d.cts +3 -0
- package/build/legacy/queryCache.d.ts +3 -0
- package/build/legacy/queryCache.js +116 -0
- package/build/legacy/queryCache.js.map +1 -0
- package/build/legacy/queryClient-4ba6364e.d.ts +916 -0
- package/build/legacy/queryClient-d615ed9f.d.ts +916 -0
- package/build/legacy/queryClient.cjs +322 -0
- package/build/legacy/queryClient.cjs.map +1 -0
- package/build/legacy/queryClient.d.cts +3 -0
- package/build/legacy/queryClient.d.ts +3 -0
- package/build/legacy/queryClient.js +304 -0
- package/build/legacy/queryClient.js.map +1 -0
- package/build/legacy/queryObserver.cjs +501 -0
- package/build/legacy/queryObserver.cjs.map +1 -0
- package/build/legacy/queryObserver.d.cts +3 -0
- package/build/legacy/queryObserver.d.ts +3 -0
- package/build/legacy/queryObserver.js +484 -0
- package/build/legacy/queryObserver.js.map +1 -0
- package/build/legacy/removable.cjs +77 -0
- package/build/legacy/removable.cjs.map +1 -0
- package/build/legacy/removable.d.cts +11 -0
- package/build/{lib → legacy}/removable.d.ts +3 -2
- package/build/legacy/removable.js +53 -0
- package/build/legacy/removable.js.map +1 -0
- package/build/legacy/retryer.cjs +169 -0
- package/build/legacy/retryer.cjs.map +1 -0
- package/build/legacy/retryer.d.cts +3 -0
- package/build/legacy/retryer.d.ts +3 -0
- package/build/{lib/retryer.legacy.js → legacy/retryer.js} +37 -48
- package/build/legacy/retryer.js.map +1 -0
- package/build/legacy/subscribable.cjs +49 -0
- package/build/legacy/subscribable.cjs.map +1 -0
- package/build/legacy/subscribable.d.cts +11 -0
- package/build/{lib → legacy}/subscribable.d.ts +3 -3
- package/build/{lib → legacy}/subscribable.js +5 -6
- package/build/legacy/subscribable.js.map +1 -0
- package/build/legacy/types.cjs +17 -0
- package/build/legacy/types.cjs.map +1 -0
- package/build/legacy/types.d.cts +3 -0
- package/build/legacy/types.d.ts +3 -0
- package/build/legacy/types.js +1 -0
- package/build/legacy/types.js.map +1 -0
- package/build/{lib/utils.legacy.cjs → legacy/utils.cjs} +92 -93
- package/build/legacy/utils.cjs.map +1 -0
- package/build/legacy/utils.d.cts +3 -0
- package/build/legacy/utils.d.ts +3 -0
- package/build/{lib/utils.legacy.js → legacy/utils.js} +49 -72
- package/build/legacy/utils.js.map +1 -0
- package/build/modern/focusManager.cjs +91 -0
- package/build/modern/focusManager.cjs.map +1 -0
- package/build/modern/focusManager.d.cts +16 -0
- package/build/modern/focusManager.d.ts +16 -0
- package/build/modern/focusManager.js +66 -0
- package/build/modern/focusManager.js.map +1 -0
- package/build/modern/hydration.cjs +107 -0
- package/build/modern/hydration.cjs.map +1 -0
- package/build/modern/hydration.d.cts +35 -0
- package/build/modern/hydration.d.ts +35 -0
- package/build/modern/hydration.js +80 -0
- package/build/modern/hydration.js.map +1 -0
- package/build/modern/index.cjs +85 -0
- package/build/modern/index.cjs.map +1 -0
- package/build/modern/index.d.cts +9 -0
- package/build/modern/index.d.ts +9 -0
- package/build/modern/index.js +50 -0
- package/build/modern/index.js.map +1 -0
- package/build/modern/infiniteQueryBehavior.cjs +138 -0
- package/build/modern/infiniteQueryBehavior.cjs.map +1 -0
- package/build/modern/infiniteQueryBehavior.d.cts +15 -0
- package/build/modern/infiniteQueryBehavior.d.ts +15 -0
- package/build/{lib → modern}/infiniteQueryBehavior.js +46 -53
- package/build/modern/infiniteQueryBehavior.js.map +1 -0
- package/build/modern/infiniteQueryObserver.cjs +87 -0
- package/build/modern/infiniteQueryObserver.cjs.map +1 -0
- package/build/modern/infiniteQueryObserver.d.cts +19 -0
- package/build/modern/infiniteQueryObserver.d.ts +19 -0
- package/build/{lib → modern}/infiniteQueryObserver.js +23 -31
- package/build/modern/infiniteQueryObserver.js.map +1 -0
- package/build/modern/mutation.cjs +259 -0
- package/build/modern/mutation.cjs.map +1 -0
- package/build/modern/mutation.d.cts +3 -0
- package/build/modern/mutation.d.ts +3 -0
- package/build/{lib → modern}/mutation.js +86 -86
- package/build/modern/mutation.js.map +1 -0
- package/build/modern/mutationCache.cjs +103 -0
- package/build/modern/mutationCache.cjs.map +1 -0
- package/build/modern/mutationCache.d.cts +3 -0
- package/build/modern/mutationCache.d.ts +3 -0
- package/build/modern/mutationCache.js +79 -0
- package/build/modern/mutationCache.js.map +1 -0
- package/build/modern/mutationObserver.cjs +132 -0
- package/build/modern/mutationObserver.cjs.map +1 -0
- package/build/modern/mutationObserver.d.cts +3 -0
- package/build/modern/mutationObserver.d.ts +3 -0
- package/build/{lib → modern}/mutationObserver.js +44 -32
- package/build/modern/mutationObserver.js.map +1 -0
- package/build/modern/notifyManager.cjs +97 -0
- package/build/modern/notifyManager.cjs.map +1 -0
- package/build/modern/notifyManager.d.cts +20 -0
- package/build/modern/notifyManager.d.ts +20 -0
- package/build/{lib/notifyManager.legacy.js → modern/notifyManager.js} +14 -31
- package/build/modern/notifyManager.js.map +1 -0
- package/build/modern/onlineManager.cjs +82 -0
- package/build/modern/onlineManager.cjs.map +1 -0
- package/build/modern/onlineManager.d.cts +16 -0
- package/build/modern/onlineManager.d.ts +16 -0
- package/build/modern/onlineManager.js +57 -0
- package/build/modern/onlineManager.js.map +1 -0
- package/build/modern/queriesObserver.cjs +202 -0
- package/build/modern/queriesObserver.cjs.map +1 -0
- package/build/modern/queriesObserver.d.cts +26 -0
- package/build/modern/queriesObserver.d.ts +26 -0
- package/build/{lib → modern}/queriesObserver.js +69 -50
- package/build/modern/queriesObserver.js.map +1 -0
- package/build/{lib → modern}/query.cjs +143 -186
- package/build/modern/query.cjs.map +1 -0
- package/build/modern/query.d.cts +3 -0
- package/build/modern/query.d.ts +3 -0
- package/build/{lib → modern}/query.js +110 -175
- package/build/modern/query.js.map +1 -0
- package/build/modern/queryCache.cjs +120 -0
- package/build/modern/queryCache.cjs.map +1 -0
- package/build/modern/queryCache.d.cts +3 -0
- package/build/modern/queryCache.d.ts +3 -0
- package/build/{lib → modern}/queryCache.js +21 -29
- package/build/modern/queryCache.js.map +1 -0
- package/build/modern/queryClient-4ba6364e.d.ts +916 -0
- package/build/modern/queryClient-d615ed9f.d.ts +916 -0
- package/build/modern/queryClient.cjs +284 -0
- package/build/modern/queryClient.cjs.map +1 -0
- package/build/modern/queryClient.d.cts +3 -0
- package/build/modern/queryClient.d.ts +3 -0
- package/build/{lib → modern}/queryClient.js +77 -94
- package/build/modern/queryClient.js.map +1 -0
- package/build/{lib → modern}/queryObserver.cjs +133 -149
- package/build/modern/queryObserver.cjs.map +1 -0
- package/build/modern/queryObserver.d.cts +3 -0
- package/build/modern/queryObserver.d.ts +3 -0
- package/build/{lib → modern}/queryObserver.js +107 -138
- package/build/modern/queryObserver.js.map +1 -0
- package/build/modern/removable.cjs +55 -0
- package/build/modern/removable.cjs.map +1 -0
- package/build/modern/removable.d.cts +11 -0
- package/build/modern/removable.d.ts +11 -0
- package/build/{lib → modern}/removable.js +10 -8
- package/build/modern/removable.js.map +1 -0
- package/build/{lib → modern}/retryer.cjs +50 -44
- package/build/modern/retryer.cjs.map +1 -0
- package/build/modern/retryer.d.cts +3 -0
- package/build/modern/retryer.d.ts +3 -0
- package/build/{lib → modern}/retryer.js +23 -39
- package/build/modern/retryer.js.map +1 -0
- package/build/modern/subscribable.cjs +49 -0
- package/build/modern/subscribable.cjs.map +1 -0
- package/build/modern/subscribable.d.cts +11 -0
- package/build/modern/subscribable.d.ts +11 -0
- package/build/{lib/subscribable.legacy.js → modern/subscribable.js} +5 -6
- package/build/modern/subscribable.js.map +1 -0
- package/build/modern/types.cjs +17 -0
- package/build/modern/types.cjs.map +1 -0
- package/build/modern/types.d.cts +3 -0
- package/build/modern/types.d.ts +3 -0
- package/build/modern/types.js +1 -0
- package/build/modern/types.js.map +1 -0
- package/build/{lib → modern}/utils.cjs +92 -93
- package/build/modern/utils.cjs.map +1 -0
- package/build/modern/utils.d.cts +3 -0
- package/build/modern/utils.d.ts +3 -0
- package/build/{lib → modern}/utils.js +49 -72
- package/build/modern/utils.js.map +1 -0
- package/package.json +15 -13
- package/src/onlineManager.ts +16 -41
- package/src/tests/hydration.test.tsx +2 -2
- package/src/tests/onlineManager.test.tsx +6 -10
- package/src/tests/queryClient.test.tsx +9 -9
- package/src/tests/utils.ts +5 -3
- package/build/lib/_virtual/_rollupPluginBabelHelpers.legacy.cjs +0 -16
- package/build/lib/_virtual/_rollupPluginBabelHelpers.legacy.cjs.map +0 -1
- package/build/lib/_virtual/_rollupPluginBabelHelpers.legacy.js +0 -13
- package/build/lib/_virtual/_rollupPluginBabelHelpers.legacy.js.map +0 -1
- package/build/lib/focusManager.cjs +0 -75
- package/build/lib/focusManager.cjs.map +0 -1
- package/build/lib/focusManager.d.ts.map +0 -1
- package/build/lib/focusManager.js +0 -72
- package/build/lib/focusManager.js.map +0 -1
- package/build/lib/focusManager.legacy.cjs +0 -91
- package/build/lib/focusManager.legacy.cjs.map +0 -1
- package/build/lib/focusManager.legacy.js +0 -88
- package/build/lib/focusManager.legacy.js.map +0 -1
- package/build/lib/hydration.cjs +0 -97
- package/build/lib/hydration.cjs.map +0 -1
- package/build/lib/hydration.d.ts +0 -35
- package/build/lib/hydration.d.ts.map +0 -1
- package/build/lib/hydration.js +0 -92
- package/build/lib/hydration.js.map +0 -1
- package/build/lib/hydration.legacy.cjs +0 -100
- package/build/lib/hydration.legacy.cjs.map +0 -1
- package/build/lib/hydration.legacy.js +0 -95
- package/build/lib/hydration.legacy.js.map +0 -1
- package/build/lib/index.cjs +0 -40
- package/build/lib/index.cjs.map +0 -1
- package/build/lib/index.d.ts +0 -22
- package/build/lib/index.d.ts.map +0 -1
- package/build/lib/index.js +0 -14
- package/build/lib/index.js.map +0 -1
- package/build/lib/index.legacy.cjs +0 -40
- package/build/lib/index.legacy.cjs.map +0 -1
- package/build/lib/index.legacy.js +0 -14
- package/build/lib/index.legacy.js.map +0 -1
- package/build/lib/infiniteQueryBehavior.cjs +0 -123
- package/build/lib/infiniteQueryBehavior.cjs.map +0 -1
- package/build/lib/infiniteQueryBehavior.d.ts +0 -12
- package/build/lib/infiniteQueryBehavior.d.ts.map +0 -1
- package/build/lib/infiniteQueryBehavior.js.map +0 -1
- package/build/lib/infiniteQueryBehavior.legacy.cjs +0 -125
- package/build/lib/infiniteQueryBehavior.legacy.cjs.map +0 -1
- package/build/lib/infiniteQueryBehavior.legacy.js +0 -121
- package/build/lib/infiniteQueryBehavior.legacy.js.map +0 -1
- package/build/lib/infiniteQueryObserver.cjs +0 -77
- package/build/lib/infiniteQueryObserver.cjs.map +0 -1
- package/build/lib/infiniteQueryObserver.d.ts.map +0 -1
- package/build/lib/infiniteQueryObserver.js.map +0 -1
- package/build/lib/infiniteQueryObserver.legacy.cjs +0 -78
- package/build/lib/infiniteQueryObserver.legacy.cjs.map +0 -1
- package/build/lib/infiniteQueryObserver.legacy.js.map +0 -1
- package/build/lib/mutation.cjs +0 -237
- package/build/lib/mutation.cjs.map +0 -1
- package/build/lib/mutation.d.ts +0 -64
- package/build/lib/mutation.d.ts.map +0 -1
- package/build/lib/mutation.js.map +0 -1
- package/build/lib/mutation.legacy.cjs +0 -262
- package/build/lib/mutation.legacy.cjs.map +0 -1
- package/build/lib/mutation.legacy.js +0 -259
- package/build/lib/mutation.legacy.js.map +0 -1
- package/build/lib/mutationCache.cjs +0 -85
- package/build/lib/mutationCache.cjs.map +0 -1
- package/build/lib/mutationCache.d.ts +0 -59
- package/build/lib/mutationCache.d.ts.map +0 -1
- package/build/lib/mutationCache.js +0 -83
- package/build/lib/mutationCache.js.map +0 -1
- package/build/lib/mutationCache.legacy.cjs +0 -98
- package/build/lib/mutationCache.legacy.cjs.map +0 -1
- package/build/lib/mutationCache.legacy.js +0 -96
- package/build/lib/mutationCache.legacy.js.map +0 -1
- package/build/lib/mutationObserver.cjs +0 -98
- package/build/lib/mutationObserver.cjs.map +0 -1
- package/build/lib/mutationObserver.d.ts +0 -19
- package/build/lib/mutationObserver.d.ts.map +0 -1
- package/build/lib/mutationObserver.js.map +0 -1
- package/build/lib/mutationObserver.legacy.cjs +0 -128
- package/build/lib/mutationObserver.legacy.cjs.map +0 -1
- package/build/lib/mutationObserver.legacy.js +0 -126
- package/build/lib/mutationObserver.legacy.js.map +0 -1
- package/build/lib/notifyManager.cjs +0 -92
- package/build/lib/notifyManager.cjs.map +0 -1
- package/build/lib/notifyManager.d.ts.map +0 -1
- package/build/lib/notifyManager.js.map +0 -1
- package/build/lib/notifyManager.legacy.cjs +0 -92
- package/build/lib/notifyManager.legacy.cjs.map +0 -1
- package/build/lib/notifyManager.legacy.js.map +0 -1
- package/build/lib/onlineManager.cjs +0 -80
- package/build/lib/onlineManager.cjs.map +0 -1
- package/build/lib/onlineManager.d.ts +0 -15
- package/build/lib/onlineManager.d.ts.map +0 -1
- package/build/lib/onlineManager.js +0 -77
- package/build/lib/onlineManager.js.map +0 -1
- package/build/lib/onlineManager.legacy.cjs +0 -95
- package/build/lib/onlineManager.legacy.cjs.map +0 -1
- package/build/lib/onlineManager.legacy.js +0 -92
- package/build/lib/onlineManager.legacy.js.map +0 -1
- package/build/lib/queriesObserver.cjs +0 -161
- package/build/lib/queriesObserver.cjs.map +0 -1
- package/build/lib/queriesObserver.d.ts.map +0 -1
- package/build/lib/queriesObserver.js.map +0 -1
- package/build/lib/queriesObserver.legacy.cjs +0 -207
- package/build/lib/queriesObserver.legacy.cjs.map +0 -1
- package/build/lib/queriesObserver.legacy.js +0 -205
- package/build/lib/queriesObserver.legacy.js.map +0 -1
- package/build/lib/query.cjs.map +0 -1
- package/build/lib/query.d.ts +0 -115
- package/build/lib/query.d.ts.map +0 -1
- package/build/lib/query.js.map +0 -1
- package/build/lib/query.legacy.cjs +0 -471
- package/build/lib/query.legacy.cjs.map +0 -1
- package/build/lib/query.legacy.js +0 -469
- package/build/lib/query.legacy.js.map +0 -1
- package/build/lib/queryCache.cjs +0 -106
- package/build/lib/queryCache.cjs.map +0 -1
- package/build/lib/queryCache.d.ts +0 -71
- package/build/lib/queryCache.d.ts.map +0 -1
- package/build/lib/queryCache.js.map +0 -1
- package/build/lib/queryCache.legacy.cjs +0 -111
- package/build/lib/queryCache.legacy.cjs.map +0 -1
- package/build/lib/queryCache.legacy.js +0 -109
- package/build/lib/queryCache.legacy.js.map +0 -1
- package/build/lib/queryClient.cjs +0 -285
- package/build/lib/queryClient.cjs.map +0 -1
- package/build/lib/queryClient.d.ts +0 -41
- package/build/lib/queryClient.d.ts.map +0 -1
- package/build/lib/queryClient.js.map +0 -1
- package/build/lib/queryClient.legacy.cjs +0 -322
- package/build/lib/queryClient.legacy.cjs.map +0 -1
- package/build/lib/queryClient.legacy.js +0 -320
- package/build/lib/queryClient.legacy.js.map +0 -1
- package/build/lib/queryObserver.cjs.map +0 -1
- package/build/lib/queryObserver.d.ts +0 -35
- package/build/lib/queryObserver.d.ts.map +0 -1
- package/build/lib/queryObserver.js.map +0 -1
- package/build/lib/queryObserver.legacy.cjs +0 -561
- package/build/lib/queryObserver.legacy.cjs.map +0 -1
- package/build/lib/queryObserver.legacy.js +0 -559
- package/build/lib/queryObserver.legacy.js.map +0 -1
- package/build/lib/removable.cjs +0 -31
- package/build/lib/removable.cjs.map +0 -1
- package/build/lib/removable.d.ts.map +0 -1
- package/build/lib/removable.js.map +0 -1
- package/build/lib/removable.legacy.cjs +0 -38
- package/build/lib/removable.legacy.cjs.map +0 -1
- package/build/lib/removable.legacy.js +0 -36
- package/build/lib/removable.legacy.js.map +0 -1
- package/build/lib/retryer.cjs.map +0 -1
- package/build/lib/retryer.d.ts +0 -34
- package/build/lib/retryer.d.ts.map +0 -1
- package/build/lib/retryer.js.map +0 -1
- package/build/lib/retryer.legacy.cjs +0 -158
- package/build/lib/retryer.legacy.cjs.map +0 -1
- package/build/lib/retryer.legacy.js.map +0 -1
- package/build/lib/subscribable.cjs +0 -28
- package/build/lib/subscribable.cjs.map +0 -1
- package/build/lib/subscribable.d.ts.map +0 -1
- package/build/lib/subscribable.js.map +0 -1
- package/build/lib/subscribable.legacy.cjs +0 -28
- package/build/lib/subscribable.legacy.cjs.map +0 -1
- package/build/lib/subscribable.legacy.js.map +0 -1
- package/build/lib/tests/focusManager.test.d.ts +0 -2
- package/build/lib/tests/focusManager.test.d.ts.map +0 -1
- package/build/lib/tests/hydration.test.d.ts +0 -2
- package/build/lib/tests/hydration.test.d.ts.map +0 -1
- package/build/lib/tests/infiniteQueryBehavior.test.d.ts +0 -2
- package/build/lib/tests/infiniteQueryBehavior.test.d.ts.map +0 -1
- package/build/lib/tests/infiniteQueryObserver.test.d.ts +0 -2
- package/build/lib/tests/infiniteQueryObserver.test.d.ts.map +0 -1
- package/build/lib/tests/mutationCache.test.d.ts +0 -2
- package/build/lib/tests/mutationCache.test.d.ts.map +0 -1
- package/build/lib/tests/mutationObserver.test.d.ts +0 -2
- package/build/lib/tests/mutationObserver.test.d.ts.map +0 -1
- package/build/lib/tests/mutations.test.d.ts +0 -2
- package/build/lib/tests/mutations.test.d.ts.map +0 -1
- package/build/lib/tests/notifyManager.test.d.ts +0 -2
- package/build/lib/tests/notifyManager.test.d.ts.map +0 -1
- package/build/lib/tests/onlineManager.test.d.ts +0 -2
- package/build/lib/tests/onlineManager.test.d.ts.map +0 -1
- package/build/lib/tests/queriesObserver.test.d.ts +0 -2
- package/build/lib/tests/queriesObserver.test.d.ts.map +0 -1
- package/build/lib/tests/query.test.d.ts +0 -2
- package/build/lib/tests/query.test.d.ts.map +0 -1
- package/build/lib/tests/queryCache.test.d.ts +0 -2
- package/build/lib/tests/queryCache.test.d.ts.map +0 -1
- package/build/lib/tests/queryClient.test.d.ts +0 -2
- package/build/lib/tests/queryClient.test.d.ts.map +0 -1
- package/build/lib/tests/queryObserver.test.d.ts +0 -2
- package/build/lib/tests/queryObserver.test.d.ts.map +0 -1
- package/build/lib/tests/utils.d.ts +0 -17
- package/build/lib/tests/utils.d.ts.map +0 -1
- package/build/lib/tests/utils.test.d.ts +0 -2
- package/build/lib/tests/utils.test.d.ts.map +0 -1
- package/build/lib/types.d.ts +0 -437
- package/build/lib/types.d.ts.map +0 -1
- package/build/lib/utils.cjs.map +0 -1
- package/build/lib/utils.d.ts +0 -90
- package/build/lib/utils.d.ts.map +0 -1
- package/build/lib/utils.js.map +0 -1
- package/build/lib/utils.legacy.cjs.map +0 -1
- package/build/lib/utils.legacy.js.map +0 -1
|
@@ -1,559 +0,0 @@
|
|
|
1
|
-
import { classPrivateFieldLooseBase as _classPrivateFieldLooseBase, classPrivateFieldLooseKey as _classPrivateFieldLooseKey } from './_virtual/_rollupPluginBabelHelpers.legacy.js';
|
|
2
|
-
import { shallowEqualObjects, replaceData, noop, isServer, isValidTimeout, timeUntilStale } from './utils.legacy.js';
|
|
3
|
-
import { notifyManager } from './notifyManager.legacy.js';
|
|
4
|
-
import { focusManager } from './focusManager.legacy.js';
|
|
5
|
-
import { Subscribable } from './subscribable.legacy.js';
|
|
6
|
-
import { canFetch } from './retryer.legacy.js';
|
|
7
|
-
|
|
8
|
-
var _client = /*#__PURE__*/_classPrivateFieldLooseKey("client");
|
|
9
|
-
var _currentQuery = /*#__PURE__*/_classPrivateFieldLooseKey("currentQuery");
|
|
10
|
-
var _currentQueryInitialState = /*#__PURE__*/_classPrivateFieldLooseKey("currentQueryInitialState");
|
|
11
|
-
var _currentResult = /*#__PURE__*/_classPrivateFieldLooseKey("currentResult");
|
|
12
|
-
var _currentResultState = /*#__PURE__*/_classPrivateFieldLooseKey("currentResultState");
|
|
13
|
-
var _currentResultOptions = /*#__PURE__*/_classPrivateFieldLooseKey("currentResultOptions");
|
|
14
|
-
var _selectError = /*#__PURE__*/_classPrivateFieldLooseKey("selectError");
|
|
15
|
-
var _selectFn = /*#__PURE__*/_classPrivateFieldLooseKey("selectFn");
|
|
16
|
-
var _selectResult = /*#__PURE__*/_classPrivateFieldLooseKey("selectResult");
|
|
17
|
-
var _lastQueryWithDefinedData = /*#__PURE__*/_classPrivateFieldLooseKey("lastQueryWithDefinedData");
|
|
18
|
-
var _staleTimeoutId = /*#__PURE__*/_classPrivateFieldLooseKey("staleTimeoutId");
|
|
19
|
-
var _refetchIntervalId = /*#__PURE__*/_classPrivateFieldLooseKey("refetchIntervalId");
|
|
20
|
-
var _currentRefetchInterval = /*#__PURE__*/_classPrivateFieldLooseKey("currentRefetchInterval");
|
|
21
|
-
var _trackedProps = /*#__PURE__*/_classPrivateFieldLooseKey("trackedProps");
|
|
22
|
-
var _executeFetch = /*#__PURE__*/_classPrivateFieldLooseKey("executeFetch");
|
|
23
|
-
var _updateStaleTimeout = /*#__PURE__*/_classPrivateFieldLooseKey("updateStaleTimeout");
|
|
24
|
-
var _computeRefetchInterval = /*#__PURE__*/_classPrivateFieldLooseKey("computeRefetchInterval");
|
|
25
|
-
var _updateRefetchInterval = /*#__PURE__*/_classPrivateFieldLooseKey("updateRefetchInterval");
|
|
26
|
-
var _updateTimers = /*#__PURE__*/_classPrivateFieldLooseKey("updateTimers");
|
|
27
|
-
var _clearStaleTimeout = /*#__PURE__*/_classPrivateFieldLooseKey("clearStaleTimeout");
|
|
28
|
-
var _clearRefetchInterval = /*#__PURE__*/_classPrivateFieldLooseKey("clearRefetchInterval");
|
|
29
|
-
var _updateQuery = /*#__PURE__*/_classPrivateFieldLooseKey("updateQuery");
|
|
30
|
-
var _notify = /*#__PURE__*/_classPrivateFieldLooseKey("notify");
|
|
31
|
-
class QueryObserver extends Subscribable {
|
|
32
|
-
constructor(client, options) {
|
|
33
|
-
super();
|
|
34
|
-
Object.defineProperty(this, _notify, {
|
|
35
|
-
value: _notify2
|
|
36
|
-
});
|
|
37
|
-
Object.defineProperty(this, _updateQuery, {
|
|
38
|
-
value: _updateQuery2
|
|
39
|
-
});
|
|
40
|
-
Object.defineProperty(this, _clearRefetchInterval, {
|
|
41
|
-
value: _clearRefetchInterval2
|
|
42
|
-
});
|
|
43
|
-
Object.defineProperty(this, _clearStaleTimeout, {
|
|
44
|
-
value: _clearStaleTimeout2
|
|
45
|
-
});
|
|
46
|
-
Object.defineProperty(this, _updateTimers, {
|
|
47
|
-
value: _updateTimers2
|
|
48
|
-
});
|
|
49
|
-
Object.defineProperty(this, _updateRefetchInterval, {
|
|
50
|
-
value: _updateRefetchInterval2
|
|
51
|
-
});
|
|
52
|
-
Object.defineProperty(this, _computeRefetchInterval, {
|
|
53
|
-
value: _computeRefetchInterval2
|
|
54
|
-
});
|
|
55
|
-
Object.defineProperty(this, _updateStaleTimeout, {
|
|
56
|
-
value: _updateStaleTimeout2
|
|
57
|
-
});
|
|
58
|
-
Object.defineProperty(this, _executeFetch, {
|
|
59
|
-
value: _executeFetch2
|
|
60
|
-
});
|
|
61
|
-
Object.defineProperty(this, _client, {
|
|
62
|
-
writable: true,
|
|
63
|
-
value: void 0
|
|
64
|
-
});
|
|
65
|
-
Object.defineProperty(this, _currentQuery, {
|
|
66
|
-
writable: true,
|
|
67
|
-
value: undefined
|
|
68
|
-
});
|
|
69
|
-
Object.defineProperty(this, _currentQueryInitialState, {
|
|
70
|
-
writable: true,
|
|
71
|
-
value: undefined
|
|
72
|
-
});
|
|
73
|
-
Object.defineProperty(this, _currentResult, {
|
|
74
|
-
writable: true,
|
|
75
|
-
value: undefined
|
|
76
|
-
});
|
|
77
|
-
Object.defineProperty(this, _currentResultState, {
|
|
78
|
-
writable: true,
|
|
79
|
-
value: void 0
|
|
80
|
-
});
|
|
81
|
-
Object.defineProperty(this, _currentResultOptions, {
|
|
82
|
-
writable: true,
|
|
83
|
-
value: void 0
|
|
84
|
-
});
|
|
85
|
-
Object.defineProperty(this, _selectError, {
|
|
86
|
-
writable: true,
|
|
87
|
-
value: void 0
|
|
88
|
-
});
|
|
89
|
-
Object.defineProperty(this, _selectFn, {
|
|
90
|
-
writable: true,
|
|
91
|
-
value: void 0
|
|
92
|
-
});
|
|
93
|
-
Object.defineProperty(this, _selectResult, {
|
|
94
|
-
writable: true,
|
|
95
|
-
value: void 0
|
|
96
|
-
});
|
|
97
|
-
// This property keeps track of the last query with defined data.
|
|
98
|
-
// It will be used to pass the previous data and query to the placeholder function between renders.
|
|
99
|
-
Object.defineProperty(this, _lastQueryWithDefinedData, {
|
|
100
|
-
writable: true,
|
|
101
|
-
value: void 0
|
|
102
|
-
});
|
|
103
|
-
Object.defineProperty(this, _staleTimeoutId, {
|
|
104
|
-
writable: true,
|
|
105
|
-
value: void 0
|
|
106
|
-
});
|
|
107
|
-
Object.defineProperty(this, _refetchIntervalId, {
|
|
108
|
-
writable: true,
|
|
109
|
-
value: void 0
|
|
110
|
-
});
|
|
111
|
-
Object.defineProperty(this, _currentRefetchInterval, {
|
|
112
|
-
writable: true,
|
|
113
|
-
value: void 0
|
|
114
|
-
});
|
|
115
|
-
Object.defineProperty(this, _trackedProps, {
|
|
116
|
-
writable: true,
|
|
117
|
-
value: new Set()
|
|
118
|
-
});
|
|
119
|
-
_classPrivateFieldLooseBase(this, _client)[_client] = client;
|
|
120
|
-
this.options = options;
|
|
121
|
-
_classPrivateFieldLooseBase(this, _selectError)[_selectError] = null;
|
|
122
|
-
this.bindMethods();
|
|
123
|
-
this.setOptions(options);
|
|
124
|
-
}
|
|
125
|
-
bindMethods() {
|
|
126
|
-
this.refetch = this.refetch.bind(this);
|
|
127
|
-
}
|
|
128
|
-
onSubscribe() {
|
|
129
|
-
if (this.listeners.size === 1) {
|
|
130
|
-
_classPrivateFieldLooseBase(this, _currentQuery)[_currentQuery].addObserver(this);
|
|
131
|
-
if (shouldFetchOnMount(_classPrivateFieldLooseBase(this, _currentQuery)[_currentQuery], this.options)) {
|
|
132
|
-
_classPrivateFieldLooseBase(this, _executeFetch)[_executeFetch]();
|
|
133
|
-
}
|
|
134
|
-
_classPrivateFieldLooseBase(this, _updateTimers)[_updateTimers]();
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
onUnsubscribe() {
|
|
138
|
-
if (!this.hasListeners()) {
|
|
139
|
-
this.destroy();
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
shouldFetchOnReconnect() {
|
|
143
|
-
return shouldFetchOn(_classPrivateFieldLooseBase(this, _currentQuery)[_currentQuery], this.options, this.options.refetchOnReconnect);
|
|
144
|
-
}
|
|
145
|
-
shouldFetchOnWindowFocus() {
|
|
146
|
-
return shouldFetchOn(_classPrivateFieldLooseBase(this, _currentQuery)[_currentQuery], this.options, this.options.refetchOnWindowFocus);
|
|
147
|
-
}
|
|
148
|
-
destroy() {
|
|
149
|
-
this.listeners = new Set();
|
|
150
|
-
_classPrivateFieldLooseBase(this, _clearStaleTimeout)[_clearStaleTimeout]();
|
|
151
|
-
_classPrivateFieldLooseBase(this, _clearRefetchInterval)[_clearRefetchInterval]();
|
|
152
|
-
_classPrivateFieldLooseBase(this, _currentQuery)[_currentQuery].removeObserver(this);
|
|
153
|
-
}
|
|
154
|
-
setOptions(options, notifyOptions) {
|
|
155
|
-
const prevOptions = this.options;
|
|
156
|
-
const prevQuery = _classPrivateFieldLooseBase(this, _currentQuery)[_currentQuery];
|
|
157
|
-
this.options = _classPrivateFieldLooseBase(this, _client)[_client].defaultQueryOptions(options);
|
|
158
|
-
if (!shallowEqualObjects(prevOptions, this.options)) {
|
|
159
|
-
_classPrivateFieldLooseBase(this, _client)[_client].getQueryCache().notify({
|
|
160
|
-
type: 'observerOptionsUpdated',
|
|
161
|
-
query: _classPrivateFieldLooseBase(this, _currentQuery)[_currentQuery],
|
|
162
|
-
observer: this
|
|
163
|
-
});
|
|
164
|
-
}
|
|
165
|
-
if (typeof this.options.enabled !== 'undefined' && typeof this.options.enabled !== 'boolean') {
|
|
166
|
-
throw new Error('Expected enabled to be a boolean');
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
// Keep previous query key if the user does not supply one
|
|
170
|
-
if (!this.options.queryKey) {
|
|
171
|
-
this.options.queryKey = prevOptions.queryKey;
|
|
172
|
-
}
|
|
173
|
-
_classPrivateFieldLooseBase(this, _updateQuery)[_updateQuery]();
|
|
174
|
-
const mounted = this.hasListeners();
|
|
175
|
-
|
|
176
|
-
// Fetch if there are subscribers
|
|
177
|
-
if (mounted && shouldFetchOptionally(_classPrivateFieldLooseBase(this, _currentQuery)[_currentQuery], prevQuery, this.options, prevOptions)) {
|
|
178
|
-
_classPrivateFieldLooseBase(this, _executeFetch)[_executeFetch]();
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
// Update result
|
|
182
|
-
this.updateResult(notifyOptions);
|
|
183
|
-
|
|
184
|
-
// Update stale interval if needed
|
|
185
|
-
if (mounted && (_classPrivateFieldLooseBase(this, _currentQuery)[_currentQuery] !== prevQuery || this.options.enabled !== prevOptions.enabled || this.options.staleTime !== prevOptions.staleTime)) {
|
|
186
|
-
_classPrivateFieldLooseBase(this, _updateStaleTimeout)[_updateStaleTimeout]();
|
|
187
|
-
}
|
|
188
|
-
const nextRefetchInterval = _classPrivateFieldLooseBase(this, _computeRefetchInterval)[_computeRefetchInterval]();
|
|
189
|
-
|
|
190
|
-
// Update refetch interval if needed
|
|
191
|
-
if (mounted && (_classPrivateFieldLooseBase(this, _currentQuery)[_currentQuery] !== prevQuery || this.options.enabled !== prevOptions.enabled || nextRefetchInterval !== _classPrivateFieldLooseBase(this, _currentRefetchInterval)[_currentRefetchInterval])) {
|
|
192
|
-
_classPrivateFieldLooseBase(this, _updateRefetchInterval)[_updateRefetchInterval](nextRefetchInterval);
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
getOptimisticResult(options) {
|
|
196
|
-
const query = _classPrivateFieldLooseBase(this, _client)[_client].getQueryCache().build(_classPrivateFieldLooseBase(this, _client)[_client], options);
|
|
197
|
-
const result = this.createResult(query, options);
|
|
198
|
-
if (shouldAssignObserverCurrentProperties(this, result)) {
|
|
199
|
-
// this assigns the optimistic result to the current Observer
|
|
200
|
-
// because if the query function changes, useQuery will be performing
|
|
201
|
-
// an effect where it would fetch again.
|
|
202
|
-
// When the fetch finishes, we perform a deep data cloning in order
|
|
203
|
-
// to reuse objects references. This deep data clone is performed against
|
|
204
|
-
// the `observer.currentResult.data` property
|
|
205
|
-
// When QueryKey changes, we refresh the query and get new `optimistic`
|
|
206
|
-
// result, while we leave the `observer.currentResult`, so when new data
|
|
207
|
-
// arrives, it finds the old `observer.currentResult` which is related
|
|
208
|
-
// to the old QueryKey. Which means that currentResult and selectData are
|
|
209
|
-
// out of sync already.
|
|
210
|
-
// To solve this, we move the cursor of the currentResult everytime
|
|
211
|
-
// an observer reads an optimistic value.
|
|
212
|
-
|
|
213
|
-
// When keeping the previous data, the result doesn't change until new
|
|
214
|
-
// data arrives.
|
|
215
|
-
_classPrivateFieldLooseBase(this, _currentResult)[_currentResult] = result;
|
|
216
|
-
_classPrivateFieldLooseBase(this, _currentResultOptions)[_currentResultOptions] = this.options;
|
|
217
|
-
_classPrivateFieldLooseBase(this, _currentResultState)[_currentResultState] = _classPrivateFieldLooseBase(this, _currentQuery)[_currentQuery].state;
|
|
218
|
-
}
|
|
219
|
-
return result;
|
|
220
|
-
}
|
|
221
|
-
getCurrentResult() {
|
|
222
|
-
return _classPrivateFieldLooseBase(this, _currentResult)[_currentResult];
|
|
223
|
-
}
|
|
224
|
-
trackResult(result) {
|
|
225
|
-
const trackedResult = {};
|
|
226
|
-
Object.keys(result).forEach(key => {
|
|
227
|
-
Object.defineProperty(trackedResult, key, {
|
|
228
|
-
configurable: false,
|
|
229
|
-
enumerable: true,
|
|
230
|
-
get: () => {
|
|
231
|
-
_classPrivateFieldLooseBase(this, _trackedProps)[_trackedProps].add(key);
|
|
232
|
-
return result[key];
|
|
233
|
-
}
|
|
234
|
-
});
|
|
235
|
-
});
|
|
236
|
-
return trackedResult;
|
|
237
|
-
}
|
|
238
|
-
getCurrentQuery() {
|
|
239
|
-
return _classPrivateFieldLooseBase(this, _currentQuery)[_currentQuery];
|
|
240
|
-
}
|
|
241
|
-
refetch({
|
|
242
|
-
...options
|
|
243
|
-
} = {}) {
|
|
244
|
-
return this.fetch({
|
|
245
|
-
...options
|
|
246
|
-
});
|
|
247
|
-
}
|
|
248
|
-
fetchOptimistic(options) {
|
|
249
|
-
const defaultedOptions = _classPrivateFieldLooseBase(this, _client)[_client].defaultQueryOptions(options);
|
|
250
|
-
const query = _classPrivateFieldLooseBase(this, _client)[_client].getQueryCache().build(_classPrivateFieldLooseBase(this, _client)[_client], defaultedOptions);
|
|
251
|
-
query.isFetchingOptimistic = true;
|
|
252
|
-
return query.fetch().then(() => this.createResult(query, defaultedOptions));
|
|
253
|
-
}
|
|
254
|
-
fetch(fetchOptions) {
|
|
255
|
-
var _fetchOptions$cancelR;
|
|
256
|
-
return _classPrivateFieldLooseBase(this, _executeFetch)[_executeFetch]({
|
|
257
|
-
...fetchOptions,
|
|
258
|
-
cancelRefetch: (_fetchOptions$cancelR = fetchOptions.cancelRefetch) != null ? _fetchOptions$cancelR : true
|
|
259
|
-
}).then(() => {
|
|
260
|
-
this.updateResult();
|
|
261
|
-
return _classPrivateFieldLooseBase(this, _currentResult)[_currentResult];
|
|
262
|
-
});
|
|
263
|
-
}
|
|
264
|
-
createResult(query, options) {
|
|
265
|
-
const prevQuery = _classPrivateFieldLooseBase(this, _currentQuery)[_currentQuery];
|
|
266
|
-
const prevOptions = this.options;
|
|
267
|
-
const prevResult = _classPrivateFieldLooseBase(this, _currentResult)[_currentResult];
|
|
268
|
-
const prevResultState = _classPrivateFieldLooseBase(this, _currentResultState)[_currentResultState];
|
|
269
|
-
const prevResultOptions = _classPrivateFieldLooseBase(this, _currentResultOptions)[_currentResultOptions];
|
|
270
|
-
const queryChange = query !== prevQuery;
|
|
271
|
-
const queryInitialState = queryChange ? query.state : _classPrivateFieldLooseBase(this, _currentQueryInitialState)[_currentQueryInitialState];
|
|
272
|
-
const {
|
|
273
|
-
state
|
|
274
|
-
} = query;
|
|
275
|
-
let {
|
|
276
|
-
error,
|
|
277
|
-
errorUpdatedAt,
|
|
278
|
-
fetchStatus,
|
|
279
|
-
status
|
|
280
|
-
} = state;
|
|
281
|
-
let isPlaceholderData = false;
|
|
282
|
-
let data;
|
|
283
|
-
|
|
284
|
-
// Optimistically set result in fetching state if needed
|
|
285
|
-
if (options._optimisticResults) {
|
|
286
|
-
const mounted = this.hasListeners();
|
|
287
|
-
const fetchOnMount = !mounted && shouldFetchOnMount(query, options);
|
|
288
|
-
const fetchOptionally = mounted && shouldFetchOptionally(query, prevQuery, options, prevOptions);
|
|
289
|
-
if (fetchOnMount || fetchOptionally) {
|
|
290
|
-
fetchStatus = canFetch(query.options.networkMode) ? 'fetching' : 'paused';
|
|
291
|
-
if (!state.dataUpdatedAt) {
|
|
292
|
-
status = 'pending';
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
if (options._optimisticResults === 'isRestoring') {
|
|
296
|
-
fetchStatus = 'idle';
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
// Select data if needed
|
|
301
|
-
if (options.select && typeof state.data !== 'undefined') {
|
|
302
|
-
// Memoize select result
|
|
303
|
-
if (prevResult && state.data === (prevResultState == null ? void 0 : prevResultState.data) && options.select === _classPrivateFieldLooseBase(this, _selectFn)[_selectFn]) {
|
|
304
|
-
data = _classPrivateFieldLooseBase(this, _selectResult)[_selectResult];
|
|
305
|
-
} else {
|
|
306
|
-
try {
|
|
307
|
-
_classPrivateFieldLooseBase(this, _selectFn)[_selectFn] = options.select;
|
|
308
|
-
data = options.select(state.data);
|
|
309
|
-
data = replaceData(prevResult == null ? void 0 : prevResult.data, data, options);
|
|
310
|
-
_classPrivateFieldLooseBase(this, _selectResult)[_selectResult] = data;
|
|
311
|
-
_classPrivateFieldLooseBase(this, _selectError)[_selectError] = null;
|
|
312
|
-
} catch (selectError) {
|
|
313
|
-
_classPrivateFieldLooseBase(this, _selectError)[_selectError] = selectError;
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
// Use query data
|
|
318
|
-
else {
|
|
319
|
-
data = state.data;
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
// Show placeholder data if needed
|
|
323
|
-
if (typeof options.placeholderData !== 'undefined' && typeof data === 'undefined' && status === 'pending') {
|
|
324
|
-
let placeholderData;
|
|
325
|
-
|
|
326
|
-
// Memoize placeholder data
|
|
327
|
-
if (prevResult != null && prevResult.isPlaceholderData && options.placeholderData === (prevResultOptions == null ? void 0 : prevResultOptions.placeholderData)) {
|
|
328
|
-
placeholderData = prevResult.data;
|
|
329
|
-
} else {
|
|
330
|
-
var _classPrivateFieldLoo;
|
|
331
|
-
placeholderData = typeof options.placeholderData === 'function' ? options.placeholderData((_classPrivateFieldLoo = _classPrivateFieldLooseBase(this, _lastQueryWithDefinedData)[_lastQueryWithDefinedData]) == null ? void 0 : _classPrivateFieldLoo.state.data, _classPrivateFieldLooseBase(this, _lastQueryWithDefinedData)[_lastQueryWithDefinedData]) : options.placeholderData;
|
|
332
|
-
if (options.select && typeof placeholderData !== 'undefined') {
|
|
333
|
-
try {
|
|
334
|
-
placeholderData = options.select(placeholderData);
|
|
335
|
-
_classPrivateFieldLooseBase(this, _selectError)[_selectError] = null;
|
|
336
|
-
} catch (selectError) {
|
|
337
|
-
_classPrivateFieldLooseBase(this, _selectError)[_selectError] = selectError;
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
if (typeof placeholderData !== 'undefined') {
|
|
342
|
-
status = 'success';
|
|
343
|
-
data = replaceData(prevResult == null ? void 0 : prevResult.data, placeholderData, options);
|
|
344
|
-
isPlaceholderData = true;
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
if (_classPrivateFieldLooseBase(this, _selectError)[_selectError]) {
|
|
348
|
-
error = _classPrivateFieldLooseBase(this, _selectError)[_selectError];
|
|
349
|
-
data = _classPrivateFieldLooseBase(this, _selectResult)[_selectResult];
|
|
350
|
-
errorUpdatedAt = Date.now();
|
|
351
|
-
status = 'error';
|
|
352
|
-
}
|
|
353
|
-
const isFetching = fetchStatus === 'fetching';
|
|
354
|
-
const isPending = status === 'pending';
|
|
355
|
-
const isError = status === 'error';
|
|
356
|
-
const isLoading = isPending && isFetching;
|
|
357
|
-
const result = {
|
|
358
|
-
status,
|
|
359
|
-
fetchStatus,
|
|
360
|
-
isPending,
|
|
361
|
-
isSuccess: status === 'success',
|
|
362
|
-
isError,
|
|
363
|
-
isInitialLoading: isLoading,
|
|
364
|
-
isLoading,
|
|
365
|
-
data,
|
|
366
|
-
dataUpdatedAt: state.dataUpdatedAt,
|
|
367
|
-
error,
|
|
368
|
-
errorUpdatedAt,
|
|
369
|
-
failureCount: state.fetchFailureCount,
|
|
370
|
-
failureReason: state.fetchFailureReason,
|
|
371
|
-
errorUpdateCount: state.errorUpdateCount,
|
|
372
|
-
isFetched: state.dataUpdateCount > 0 || state.errorUpdateCount > 0,
|
|
373
|
-
isFetchedAfterMount: state.dataUpdateCount > queryInitialState.dataUpdateCount || state.errorUpdateCount > queryInitialState.errorUpdateCount,
|
|
374
|
-
isFetching,
|
|
375
|
-
isRefetching: isFetching && !isPending,
|
|
376
|
-
isLoadingError: isError && state.dataUpdatedAt === 0,
|
|
377
|
-
isPaused: fetchStatus === 'paused',
|
|
378
|
-
isPlaceholderData,
|
|
379
|
-
isRefetchError: isError && state.dataUpdatedAt !== 0,
|
|
380
|
-
isStale: isStale(query, options),
|
|
381
|
-
refetch: this.refetch
|
|
382
|
-
};
|
|
383
|
-
return result;
|
|
384
|
-
}
|
|
385
|
-
updateResult(notifyOptions) {
|
|
386
|
-
const prevResult = _classPrivateFieldLooseBase(this, _currentResult)[_currentResult];
|
|
387
|
-
const nextResult = this.createResult(_classPrivateFieldLooseBase(this, _currentQuery)[_currentQuery], this.options);
|
|
388
|
-
_classPrivateFieldLooseBase(this, _currentResultState)[_currentResultState] = _classPrivateFieldLooseBase(this, _currentQuery)[_currentQuery].state;
|
|
389
|
-
_classPrivateFieldLooseBase(this, _currentResultOptions)[_currentResultOptions] = this.options;
|
|
390
|
-
|
|
391
|
-
// Only notify and update result if something has changed
|
|
392
|
-
if (shallowEqualObjects(nextResult, prevResult)) {
|
|
393
|
-
return;
|
|
394
|
-
}
|
|
395
|
-
if (_classPrivateFieldLooseBase(this, _currentResultState)[_currentResultState].data !== undefined) {
|
|
396
|
-
_classPrivateFieldLooseBase(this, _lastQueryWithDefinedData)[_lastQueryWithDefinedData] = _classPrivateFieldLooseBase(this, _currentQuery)[_currentQuery];
|
|
397
|
-
}
|
|
398
|
-
_classPrivateFieldLooseBase(this, _currentResult)[_currentResult] = nextResult;
|
|
399
|
-
|
|
400
|
-
// Determine which callbacks to trigger
|
|
401
|
-
const defaultNotifyOptions = {};
|
|
402
|
-
const shouldNotifyListeners = () => {
|
|
403
|
-
if (!prevResult) {
|
|
404
|
-
return true;
|
|
405
|
-
}
|
|
406
|
-
const {
|
|
407
|
-
notifyOnChangeProps
|
|
408
|
-
} = this.options;
|
|
409
|
-
if (notifyOnChangeProps === 'all' || !notifyOnChangeProps && !_classPrivateFieldLooseBase(this, _trackedProps)[_trackedProps].size) {
|
|
410
|
-
return true;
|
|
411
|
-
}
|
|
412
|
-
const includedProps = new Set(notifyOnChangeProps != null ? notifyOnChangeProps : _classPrivateFieldLooseBase(this, _trackedProps)[_trackedProps]);
|
|
413
|
-
if (this.options.throwOnError) {
|
|
414
|
-
includedProps.add('error');
|
|
415
|
-
}
|
|
416
|
-
return Object.keys(_classPrivateFieldLooseBase(this, _currentResult)[_currentResult]).some(key => {
|
|
417
|
-
const typedKey = key;
|
|
418
|
-
const changed = _classPrivateFieldLooseBase(this, _currentResult)[_currentResult][typedKey] !== prevResult[typedKey];
|
|
419
|
-
return changed && includedProps.has(typedKey);
|
|
420
|
-
});
|
|
421
|
-
};
|
|
422
|
-
if ((notifyOptions == null ? void 0 : notifyOptions.listeners) !== false && shouldNotifyListeners()) {
|
|
423
|
-
defaultNotifyOptions.listeners = true;
|
|
424
|
-
}
|
|
425
|
-
_classPrivateFieldLooseBase(this, _notify)[_notify]({
|
|
426
|
-
...defaultNotifyOptions,
|
|
427
|
-
...notifyOptions
|
|
428
|
-
});
|
|
429
|
-
}
|
|
430
|
-
onQueryUpdate() {
|
|
431
|
-
this.updateResult();
|
|
432
|
-
if (this.hasListeners()) {
|
|
433
|
-
_classPrivateFieldLooseBase(this, _updateTimers)[_updateTimers]();
|
|
434
|
-
}
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
function _executeFetch2(fetchOptions) {
|
|
438
|
-
// Make sure we reference the latest query as the current one might have been removed
|
|
439
|
-
_classPrivateFieldLooseBase(this, _updateQuery)[_updateQuery]();
|
|
440
|
-
|
|
441
|
-
// Fetch
|
|
442
|
-
let promise = _classPrivateFieldLooseBase(this, _currentQuery)[_currentQuery].fetch(this.options, fetchOptions);
|
|
443
|
-
if (!(fetchOptions != null && fetchOptions.throwOnError)) {
|
|
444
|
-
promise = promise.catch(noop);
|
|
445
|
-
}
|
|
446
|
-
return promise;
|
|
447
|
-
}
|
|
448
|
-
function _updateStaleTimeout2() {
|
|
449
|
-
_classPrivateFieldLooseBase(this, _clearStaleTimeout)[_clearStaleTimeout]();
|
|
450
|
-
if (isServer || _classPrivateFieldLooseBase(this, _currentResult)[_currentResult].isStale || !isValidTimeout(this.options.staleTime)) {
|
|
451
|
-
return;
|
|
452
|
-
}
|
|
453
|
-
const time = timeUntilStale(_classPrivateFieldLooseBase(this, _currentResult)[_currentResult].dataUpdatedAt, this.options.staleTime);
|
|
454
|
-
|
|
455
|
-
// The timeout is sometimes triggered 1 ms before the stale time expiration.
|
|
456
|
-
// To mitigate this issue we always add 1 ms to the timeout.
|
|
457
|
-
const timeout = time + 1;
|
|
458
|
-
_classPrivateFieldLooseBase(this, _staleTimeoutId)[_staleTimeoutId] = setTimeout(() => {
|
|
459
|
-
if (!_classPrivateFieldLooseBase(this, _currentResult)[_currentResult].isStale) {
|
|
460
|
-
this.updateResult();
|
|
461
|
-
}
|
|
462
|
-
}, timeout);
|
|
463
|
-
}
|
|
464
|
-
function _computeRefetchInterval2() {
|
|
465
|
-
var _ref;
|
|
466
|
-
return (_ref = typeof this.options.refetchInterval === 'function' ? this.options.refetchInterval(_classPrivateFieldLooseBase(this, _currentResult)[_currentResult].data, _classPrivateFieldLooseBase(this, _currentQuery)[_currentQuery]) : this.options.refetchInterval) != null ? _ref : false;
|
|
467
|
-
}
|
|
468
|
-
function _updateRefetchInterval2(nextInterval) {
|
|
469
|
-
_classPrivateFieldLooseBase(this, _clearRefetchInterval)[_clearRefetchInterval]();
|
|
470
|
-
_classPrivateFieldLooseBase(this, _currentRefetchInterval)[_currentRefetchInterval] = nextInterval;
|
|
471
|
-
if (isServer || this.options.enabled === false || !isValidTimeout(_classPrivateFieldLooseBase(this, _currentRefetchInterval)[_currentRefetchInterval]) || _classPrivateFieldLooseBase(this, _currentRefetchInterval)[_currentRefetchInterval] === 0) {
|
|
472
|
-
return;
|
|
473
|
-
}
|
|
474
|
-
_classPrivateFieldLooseBase(this, _refetchIntervalId)[_refetchIntervalId] = setInterval(() => {
|
|
475
|
-
if (this.options.refetchIntervalInBackground || focusManager.isFocused()) {
|
|
476
|
-
_classPrivateFieldLooseBase(this, _executeFetch)[_executeFetch]();
|
|
477
|
-
}
|
|
478
|
-
}, _classPrivateFieldLooseBase(this, _currentRefetchInterval)[_currentRefetchInterval]);
|
|
479
|
-
}
|
|
480
|
-
function _updateTimers2() {
|
|
481
|
-
_classPrivateFieldLooseBase(this, _updateStaleTimeout)[_updateStaleTimeout]();
|
|
482
|
-
_classPrivateFieldLooseBase(this, _updateRefetchInterval)[_updateRefetchInterval](_classPrivateFieldLooseBase(this, _computeRefetchInterval)[_computeRefetchInterval]());
|
|
483
|
-
}
|
|
484
|
-
function _clearStaleTimeout2() {
|
|
485
|
-
if (_classPrivateFieldLooseBase(this, _staleTimeoutId)[_staleTimeoutId]) {
|
|
486
|
-
clearTimeout(_classPrivateFieldLooseBase(this, _staleTimeoutId)[_staleTimeoutId]);
|
|
487
|
-
_classPrivateFieldLooseBase(this, _staleTimeoutId)[_staleTimeoutId] = undefined;
|
|
488
|
-
}
|
|
489
|
-
}
|
|
490
|
-
function _clearRefetchInterval2() {
|
|
491
|
-
if (_classPrivateFieldLooseBase(this, _refetchIntervalId)[_refetchIntervalId]) {
|
|
492
|
-
clearInterval(_classPrivateFieldLooseBase(this, _refetchIntervalId)[_refetchIntervalId]);
|
|
493
|
-
_classPrivateFieldLooseBase(this, _refetchIntervalId)[_refetchIntervalId] = undefined;
|
|
494
|
-
}
|
|
495
|
-
}
|
|
496
|
-
function _updateQuery2() {
|
|
497
|
-
const query = _classPrivateFieldLooseBase(this, _client)[_client].getQueryCache().build(_classPrivateFieldLooseBase(this, _client)[_client], this.options);
|
|
498
|
-
if (query === _classPrivateFieldLooseBase(this, _currentQuery)[_currentQuery]) {
|
|
499
|
-
return;
|
|
500
|
-
}
|
|
501
|
-
const prevQuery = _classPrivateFieldLooseBase(this, _currentQuery)[_currentQuery];
|
|
502
|
-
_classPrivateFieldLooseBase(this, _currentQuery)[_currentQuery] = query;
|
|
503
|
-
_classPrivateFieldLooseBase(this, _currentQueryInitialState)[_currentQueryInitialState] = query.state;
|
|
504
|
-
if (this.hasListeners()) {
|
|
505
|
-
prevQuery == null ? void 0 : prevQuery.removeObserver(this);
|
|
506
|
-
query.addObserver(this);
|
|
507
|
-
}
|
|
508
|
-
}
|
|
509
|
-
function _notify2(notifyOptions) {
|
|
510
|
-
notifyManager.batch(() => {
|
|
511
|
-
// First, trigger the listeners
|
|
512
|
-
if (notifyOptions.listeners) {
|
|
513
|
-
this.listeners.forEach(listener => {
|
|
514
|
-
listener(_classPrivateFieldLooseBase(this, _currentResult)[_currentResult]);
|
|
515
|
-
});
|
|
516
|
-
}
|
|
517
|
-
|
|
518
|
-
// Then the cache listeners
|
|
519
|
-
_classPrivateFieldLooseBase(this, _client)[_client].getQueryCache().notify({
|
|
520
|
-
query: _classPrivateFieldLooseBase(this, _currentQuery)[_currentQuery],
|
|
521
|
-
type: 'observerResultsUpdated'
|
|
522
|
-
});
|
|
523
|
-
});
|
|
524
|
-
}
|
|
525
|
-
function shouldLoadOnMount(query, options) {
|
|
526
|
-
return options.enabled !== false && !query.state.dataUpdatedAt && !(query.state.status === 'error' && options.retryOnMount === false);
|
|
527
|
-
}
|
|
528
|
-
function shouldFetchOnMount(query, options) {
|
|
529
|
-
return shouldLoadOnMount(query, options) || query.state.dataUpdatedAt > 0 && shouldFetchOn(query, options, options.refetchOnMount);
|
|
530
|
-
}
|
|
531
|
-
function shouldFetchOn(query, options, field) {
|
|
532
|
-
if (options.enabled !== false) {
|
|
533
|
-
const value = typeof field === 'function' ? field(query) : field;
|
|
534
|
-
return value === 'always' || value !== false && isStale(query, options);
|
|
535
|
-
}
|
|
536
|
-
return false;
|
|
537
|
-
}
|
|
538
|
-
function shouldFetchOptionally(query, prevQuery, options, prevOptions) {
|
|
539
|
-
return options.enabled !== false && (query !== prevQuery || prevOptions.enabled === false) && (!options.suspense || query.state.status !== 'error') && isStale(query, options);
|
|
540
|
-
}
|
|
541
|
-
function isStale(query, options) {
|
|
542
|
-
return query.isStaleByTime(options.staleTime);
|
|
543
|
-
}
|
|
544
|
-
|
|
545
|
-
// this function would decide if we will update the observer's 'current'
|
|
546
|
-
// properties after an optimistic reading via getOptimisticResult
|
|
547
|
-
function shouldAssignObserverCurrentProperties(observer, optimisticResult) {
|
|
548
|
-
// if the newly created result isn't what the observer is holding as current,
|
|
549
|
-
// then we'll need to update the properties as well
|
|
550
|
-
if (observer.getCurrentResult() !== optimisticResult) {
|
|
551
|
-
return true;
|
|
552
|
-
}
|
|
553
|
-
|
|
554
|
-
// basically, just keep previous properties if nothing changed
|
|
555
|
-
return false;
|
|
556
|
-
}
|
|
557
|
-
|
|
558
|
-
export { QueryObserver };
|
|
559
|
-
//# sourceMappingURL=queryObserver.legacy.js.map
|