|
|
|
|
@ -402,10 +402,10 @@ var config_provider = __webpack_require__(92736);
|
|
|
|
|
var zh_CN = __webpack_require__(81863);
|
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
|
|
|
|
|
var _react_17_0_2_react = __webpack_require__(59301);
|
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_swr@2.3.0@swr/dist/_internal/index.mjs
|
|
|
|
|
var _internal = __webpack_require__(33976);
|
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_swr@2.3.0@swr/dist/index/index.mjs
|
|
|
|
|
var index = __webpack_require__(40330);
|
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_swr@2.3.1@swr/dist/_internal/index.mjs + 1 modules
|
|
|
|
|
var _internal = __webpack_require__(28385);
|
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_swr@2.3.1@swr/dist/index/index.mjs
|
|
|
|
|
var index = __webpack_require__(88722);
|
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_@ant-design_pro-provider@2.15.3@@ant-design/pro-provider/es/intl.js + 32 modules
|
|
|
|
|
var es_intl = __webpack_require__(29228);
|
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_dayjs@1.11.13@dayjs/dayjs.min.js
|
|
|
|
|
@ -4750,9 +4750,9 @@ function theme_useToken() {
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ 89339:
|
|
|
|
|
/***/ 49572:
|
|
|
|
|
/*!***************************************************************************************************!*\
|
|
|
|
|
!*** ./node_modules/_swr@2.3.0@swr/dist/_internal/config-context-client-x_C9_NWC.mjs + 1 modules ***!
|
|
|
|
|
!*** ./node_modules/_swr@2.3.1@swr/dist/_internal/config-context-client-Cm1JTDEP.mjs + 1 modules ***!
|
|
|
|
|
\***************************************************************************************************/
|
|
|
|
|
/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
@ -4772,22 +4772,23 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
|
|
e: function() { return /* binding */ isUndefined; },
|
|
|
|
|
f: function() { return /* binding */ mergeConfigs; },
|
|
|
|
|
g: function() { return /* binding */ SWRConfig; },
|
|
|
|
|
h: function() { return /* binding */ events; },
|
|
|
|
|
i: function() { return /* binding */ isWindowDefined; },
|
|
|
|
|
m: function() { return /* binding */ mergeObjects; },
|
|
|
|
|
o: function() { return /* binding */ internalMutate; },
|
|
|
|
|
p: function() { return /* binding */ getTimestamp; },
|
|
|
|
|
n: function() { return /* binding */ internalMutate; },
|
|
|
|
|
o: function() { return /* binding */ getTimestamp; },
|
|
|
|
|
r: function() { return /* binding */ IS_SERVER; },
|
|
|
|
|
s: function() { return /* binding */ serialize; },
|
|
|
|
|
t: function() { return /* binding */ IS_SERVER; },
|
|
|
|
|
u: function() { return /* binding */ rAF; },
|
|
|
|
|
v: function() { return /* binding */ useIsomorphicLayoutEffect; },
|
|
|
|
|
t: function() { return /* binding */ rAF; },
|
|
|
|
|
u: function() { return /* binding */ useIsomorphicLayoutEffect; },
|
|
|
|
|
z: function() { return /* binding */ createCacheHelper; }
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// UNUSED EXPORTS: A, j, k, l, n, q, r, w, x, y
|
|
|
|
|
// UNUSED EXPORTS: A, h, j, k, l, p, q, v, w, x, y
|
|
|
|
|
|
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
|
|
|
|
|
var _react_17_0_2_react = __webpack_require__(59301);
|
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_swr@2.3.1@swr/dist/_internal/events.mjs
|
|
|
|
|
var events = __webpack_require__(2690);
|
|
|
|
|
;// CONCATENATED MODULE: ./node_modules/_dequal@2.0.3@dequal/lite/index.mjs
|
|
|
|
|
var has = Object.prototype.hasOwnProperty;
|
|
|
|
|
|
|
|
|
|
@ -4819,11 +4820,12 @@ function dequal(foo, bar) {
|
|
|
|
|
return foo !== foo && bar !== bar;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ./node_modules/_swr@2.3.0@swr/dist/_internal/config-context-client-x_C9_NWC.mjs
|
|
|
|
|
;// CONCATENATED MODULE: ./node_modules/_swr@2.3.1@swr/dist/_internal/config-context-client-Cm1JTDEP.mjs
|
|
|
|
|
'use client';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Global state used to deduplicate requests and store listeners
|
|
|
|
|
const SWRGlobalState = new WeakMap();
|
|
|
|
|
|
|
|
|
|
@ -4849,6 +4851,7 @@ const STR_UNDEFINED = 'undefined';
|
|
|
|
|
// NOTE: Use the function to guarantee it's re-evaluated between jsdom and node runtime for tests.
|
|
|
|
|
const isWindowDefined = typeof window != STR_UNDEFINED;
|
|
|
|
|
const isDocumentDefined = typeof document != STR_UNDEFINED;
|
|
|
|
|
const isLegacyDeno = isWindowDefined && 'Deno' in window;
|
|
|
|
|
const hasRequestAnimationFrame = ()=>isWindowDefined && typeof window['requestAnimationFrame'] != STR_UNDEFINED;
|
|
|
|
|
const createCacheHelper = (cache, key)=>{
|
|
|
|
|
const state = SWRGlobalState.get(cache);
|
|
|
|
|
@ -4942,7 +4945,7 @@ const defaultConfigOptions = {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const IS_REACT_LEGACY = !_react_17_0_2_react.useId;
|
|
|
|
|
const IS_SERVER = !isWindowDefined || 'Deno' in globalThis;
|
|
|
|
|
const IS_SERVER = !isWindowDefined || isLegacyDeno;
|
|
|
|
|
// Polyfill requestAnimationFrame
|
|
|
|
|
const rAF = (f)=>hasRequestAnimationFrame() ? window['requestAnimationFrame'](f) : setTimeout(f, 1);
|
|
|
|
|
// React currently throws a warning when using useLayoutEffect on the server.
|
|
|
|
|
@ -5039,19 +5042,6 @@ const serialize = (key)=>{
|
|
|
|
|
let __timestamp = 0;
|
|
|
|
|
const getTimestamp = ()=>++__timestamp;
|
|
|
|
|
|
|
|
|
|
const FOCUS_EVENT = 0;
|
|
|
|
|
const RECONNECT_EVENT = 1;
|
|
|
|
|
const MUTATE_EVENT = 2;
|
|
|
|
|
const ERROR_REVALIDATE_EVENT = 3;
|
|
|
|
|
|
|
|
|
|
var events = {
|
|
|
|
|
__proto__: null,
|
|
|
|
|
ERROR_REVALIDATE_EVENT: ERROR_REVALIDATE_EVENT,
|
|
|
|
|
FOCUS_EVENT: FOCUS_EVENT,
|
|
|
|
|
MUTATE_EVENT: MUTATE_EVENT,
|
|
|
|
|
RECONNECT_EVENT: RECONNECT_EVENT
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
async function internalMutate(...args) {
|
|
|
|
|
const [cache, _key, _data, _opts] = args;
|
|
|
|
|
// When passing as a boolean, it's explicitly used to disable/enable
|
|
|
|
|
@ -5099,7 +5089,7 @@ async function internalMutate(...args) {
|
|
|
|
|
delete FETCH[key];
|
|
|
|
|
delete PRELOAD[key];
|
|
|
|
|
if (revalidators && revalidators[0]) {
|
|
|
|
|
return revalidators[0](MUTATE_EVENT).then(()=>get().data);
|
|
|
|
|
return revalidators[0](events/* MUTATE_EVENT */.QQ).then(()=>get().data);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return get().data;
|
|
|
|
|
@ -5260,8 +5250,8 @@ const initCache = (provider, options)=>{
|
|
|
|
|
// React's state updates.
|
|
|
|
|
// This avoids some unnecessary revalidations such as
|
|
|
|
|
// https://github.com/vercel/swr/issues/1680.
|
|
|
|
|
const releaseFocus = opts.initFocus(setTimeout.bind(UNDEFINED, revalidateAllKeys.bind(UNDEFINED, EVENT_REVALIDATORS, FOCUS_EVENT)));
|
|
|
|
|
const releaseReconnect = opts.initReconnect(setTimeout.bind(UNDEFINED, revalidateAllKeys.bind(UNDEFINED, EVENT_REVALIDATORS, RECONNECT_EVENT)));
|
|
|
|
|
const releaseFocus = opts.initFocus(setTimeout.bind(UNDEFINED, revalidateAllKeys.bind(UNDEFINED, EVENT_REVALIDATORS, events/* FOCUS_EVENT */.N4)));
|
|
|
|
|
const releaseReconnect = opts.initReconnect(setTimeout.bind(UNDEFINED, revalidateAllKeys.bind(UNDEFINED, EVENT_REVALIDATORS, events/* RECONNECT_EVENT */.l2)));
|
|
|
|
|
unmount = ()=>{
|
|
|
|
|
releaseFocus && releaseFocus();
|
|
|
|
|
releaseReconnect && releaseReconnect();
|
|
|
|
|
@ -5396,39 +5386,77 @@ const SWRConfig = (props)=>{
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ 33976:
|
|
|
|
|
/*!**************************************************************!*\
|
|
|
|
|
!*** ./node_modules/_swr@2.3.0@swr/dist/_internal/index.mjs ***!
|
|
|
|
|
\**************************************************************/
|
|
|
|
|
/***/ 2690:
|
|
|
|
|
/*!***************************************************************!*\
|
|
|
|
|
!*** ./node_modules/_swr@2.3.1@swr/dist/_internal/events.mjs ***!
|
|
|
|
|
\***************************************************************/
|
|
|
|
|
/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
|
|
|
/* harmony export */ kY: function() { return /* binding */ useSWRConfig; },
|
|
|
|
|
/* harmony export */ ko: function() { return /* binding */ subscribeCallback; },
|
|
|
|
|
/* harmony export */ s6: function() { return /* binding */ withArgs; }
|
|
|
|
|
/* harmony export */ N4: function() { return /* binding */ FOCUS_EVENT; },
|
|
|
|
|
/* harmony export */ QQ: function() { return /* binding */ MUTATE_EVENT; },
|
|
|
|
|
/* harmony export */ aU: function() { return /* binding */ ERROR_REVALIDATE_EVENT; },
|
|
|
|
|
/* harmony export */ l2: function() { return /* binding */ RECONNECT_EVENT; }
|
|
|
|
|
/* harmony export */ });
|
|
|
|
|
/* unused harmony exports INFINITE_PREFIX, normalize, preload, withMiddleware */
|
|
|
|
|
/* harmony import */ var _config_context_client_x_C9_NWC_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./config-context-client-x_C9_NWC.mjs */ 89339);
|
|
|
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ 59301);
|
|
|
|
|
const FOCUS_EVENT = 0;
|
|
|
|
|
const RECONNECT_EVENT = 1;
|
|
|
|
|
const MUTATE_EVENT = 2;
|
|
|
|
|
const ERROR_REVALIDATE_EVENT = 3;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ 28385:
|
|
|
|
|
/*!**************************************************************************!*\
|
|
|
|
|
!*** ./node_modules/_swr@2.3.1@swr/dist/_internal/index.mjs + 1 modules ***!
|
|
|
|
|
\**************************************************************************/
|
|
|
|
|
/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
|
|
// EXPORTS
|
|
|
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
|
|
|
ko: function() { return /* binding */ subscribeCallback; },
|
|
|
|
|
kY: function() { return /* binding */ useSWRConfig; },
|
|
|
|
|
s6: function() { return /* binding */ withArgs; }
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// UNUSED EXPORTS: INFINITE_PREFIX, IS_REACT_LEGACY, IS_SERVER, OBJECT, SWRConfig, SWRGlobalState, UNDEFINED, cache, compare, createCacheHelper, defaultConfig, defaultConfigOptions, getTimestamp, hasRequestAnimationFrame, initCache, internalMutate, isDocumentDefined, isFunction, isLegacyDeno, isPromiseLike, isUndefined, isWindowDefined, mergeConfigs, mergeObjects, mutate, noop, normalize, preload, preset, rAF, revalidateEvents, serialize, slowConnection, stableHash, useIsomorphicLayoutEffect, withMiddleware
|
|
|
|
|
|
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_swr@2.3.1@swr/dist/_internal/config-context-client-Cm1JTDEP.mjs + 1 modules
|
|
|
|
|
var config_context_client_Cm1JTDEP = __webpack_require__(49572);
|
|
|
|
|
;// CONCATENATED MODULE: ./node_modules/_swr@2.3.1@swr/dist/_internal/constants.mjs
|
|
|
|
|
const INFINITE_PREFIX = '$inf$';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
|
|
|
|
|
var _react_17_0_2_react = __webpack_require__(59301);
|
|
|
|
|
;// CONCATENATED MODULE: ./node_modules/_swr@2.3.1@swr/dist/_internal/index.mjs
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// @ts-expect-error
|
|
|
|
|
const enableDevtools = _config_context_client_x_C9_NWC_mjs__WEBPACK_IMPORTED_MODULE_1__.i && window.__SWR_DEVTOOLS_USE__;
|
|
|
|
|
const enableDevtools = config_context_client_Cm1JTDEP.i && window.__SWR_DEVTOOLS_USE__;
|
|
|
|
|
const use = enableDevtools ? window.__SWR_DEVTOOLS_USE__ : [];
|
|
|
|
|
const setupDevTools = ()=>{
|
|
|
|
|
if (enableDevtools) {
|
|
|
|
|
// @ts-expect-error
|
|
|
|
|
window.__SWR_DEVTOOLS_REACT__ = react__WEBPACK_IMPORTED_MODULE_0__;
|
|
|
|
|
window.__SWR_DEVTOOLS_REACT__ = _react_17_0_2_react;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const normalize = (args)=>{
|
|
|
|
|
return (0,_config_context_client_x_C9_NWC_mjs__WEBPACK_IMPORTED_MODULE_1__.a)(args[1]) ? [
|
|
|
|
|
return (0,config_context_client_Cm1JTDEP.a)(args[1]) ? [
|
|
|
|
|
args[0],
|
|
|
|
|
args[1],
|
|
|
|
|
args[2] || {}
|
|
|
|
|
@ -5440,7 +5468,7 @@ const normalize = (args)=>{
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const useSWRConfig = ()=>{
|
|
|
|
|
return (0,_config_context_client_x_C9_NWC_mjs__WEBPACK_IMPORTED_MODULE_1__.m)(_config_context_client_x_C9_NWC_mjs__WEBPACK_IMPORTED_MODULE_1__.d, (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(_config_context_client_x_C9_NWC_mjs__WEBPACK_IMPORTED_MODULE_1__.S));
|
|
|
|
|
return (0,config_context_client_Cm1JTDEP.m)(config_context_client_Cm1JTDEP.d, (0,_react_17_0_2_react.useContext)(config_context_client_Cm1JTDEP.S));
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const preload = (key_, fetcher)=>{
|
|
|
|
|
@ -5455,15 +5483,15 @@ const preload = (key_, fetcher)=>{
|
|
|
|
|
const middleware = (useSWRNext)=>(key_, fetcher_, config)=>{
|
|
|
|
|
// fetcher might be a sync function, so this should not be an async function
|
|
|
|
|
const fetcher = fetcher_ && ((...args)=>{
|
|
|
|
|
const [key] = (0,_config_context_client_x_C9_NWC_mjs__WEBPACK_IMPORTED_MODULE_1__.s)(key_);
|
|
|
|
|
const [, , , PRELOAD] = _config_context_client_x_C9_NWC_mjs__WEBPACK_IMPORTED_MODULE_1__.b.get(_config_context_client_x_C9_NWC_mjs__WEBPACK_IMPORTED_MODULE_1__.c);
|
|
|
|
|
const [key] = (0,config_context_client_Cm1JTDEP.s)(key_);
|
|
|
|
|
const [, , , PRELOAD] = config_context_client_Cm1JTDEP.b.get(config_context_client_Cm1JTDEP.c);
|
|
|
|
|
if (key.startsWith(INFINITE_PREFIX)) {
|
|
|
|
|
// we want the infinite fetcher to be called.
|
|
|
|
|
// handling of the PRELOAD cache happens there.
|
|
|
|
|
return fetcher_(...args);
|
|
|
|
|
}
|
|
|
|
|
const req = PRELOAD[key];
|
|
|
|
|
if ((0,_config_context_client_x_C9_NWC_mjs__WEBPACK_IMPORTED_MODULE_1__.e)(req)) return fetcher_(...args);
|
|
|
|
|
if ((0,config_context_client_Cm1JTDEP.e)(req)) return fetcher_(...args);
|
|
|
|
|
delete PRELOAD[key];
|
|
|
|
|
return req;
|
|
|
|
|
});
|
|
|
|
|
@ -5481,7 +5509,7 @@ const withArgs = (hook)=>{
|
|
|
|
|
// Normalize arguments.
|
|
|
|
|
const [key, fn, _config] = normalize(args);
|
|
|
|
|
// Merge configurations.
|
|
|
|
|
const config = (0,_config_context_client_x_C9_NWC_mjs__WEBPACK_IMPORTED_MODULE_1__.f)(fallbackConfig, _config);
|
|
|
|
|
const config = (0,config_context_client_Cm1JTDEP.f)(fallbackConfig, _config);
|
|
|
|
|
// Apply middleware
|
|
|
|
|
let next = hook;
|
|
|
|
|
const { use } = config;
|
|
|
|
|
@ -5527,9 +5555,9 @@ setupDevTools();
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ 40330:
|
|
|
|
|
/***/ 88722:
|
|
|
|
|
/*!**********************************************************!*\
|
|
|
|
|
!*** ./node_modules/_swr@2.3.0@swr/dist/index/index.mjs ***!
|
|
|
|
|
!*** ./node_modules/_swr@2.3.1@swr/dist/index/index.mjs ***!
|
|
|
|
|
\**********************************************************/
|
|
|
|
|
/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
@ -5541,8 +5569,9 @@ setupDevTools();
|
|
|
|
|
/* unused harmony export unstable_serialize */
|
|
|
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ 59301);
|
|
|
|
|
/* harmony import */ var use_sync_external_store_shim_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! use-sync-external-store/shim/index.js */ 19590);
|
|
|
|
|
/* harmony import */ var _internal_index_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../_internal/index.mjs */ 89339);
|
|
|
|
|
/* harmony import */ var _internal_index_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../_internal/index.mjs */ 33976);
|
|
|
|
|
/* harmony import */ var _internal_index_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../_internal/index.mjs */ 49572);
|
|
|
|
|
/* harmony import */ var _internal_index_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../_internal/index.mjs */ 2690);
|
|
|
|
|
/* harmony import */ var _internal_index_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../_internal/index.mjs */ 28385);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -5791,7 +5820,8 @@ const useSWRHandler = (_key, fetcher, config)=>{
|
|
|
|
|
const error = cached.error;
|
|
|
|
|
// Use a ref to store previously returned data. Use the initial data as its initial value.
|
|
|
|
|
const laggyDataRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(data);
|
|
|
|
|
const returnedData = keepPreviousData ? (0,_internal_index_mjs__WEBPACK_IMPORTED_MODULE_2__.e)(cachedData) ? laggyDataRef.current : cachedData : data;
|
|
|
|
|
var _laggyDataRef_current;
|
|
|
|
|
const returnedData = keepPreviousData ? (0,_internal_index_mjs__WEBPACK_IMPORTED_MODULE_2__.e)(cachedData) ? (_laggyDataRef_current = laggyDataRef.current) != null ? _laggyDataRef_current : data : cachedData : data;
|
|
|
|
|
// - Suspense mode and there's stale data for the initial render.
|
|
|
|
|
// - Not suspense mode and there is no fallback data and `revalidateIfStale` is enabled.
|
|
|
|
|
// - `revalidateIfStale` is enabled but `data` is not defined.
|
|
|
|
|
@ -5885,7 +5915,7 @@ const useSWRHandler = (_key, fetcher, config)=>{
|
|
|
|
|
// Key must be truthy if entering here.
|
|
|
|
|
FETCH[key] = [
|
|
|
|
|
currentFetcher(fnArg),
|
|
|
|
|
(0,_internal_index_mjs__WEBPACK_IMPORTED_MODULE_2__.p)()
|
|
|
|
|
(0,_internal_index_mjs__WEBPACK_IMPORTED_MODULE_2__.o)()
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
// Wait until the ongoing request is done. Deduplication is also
|
|
|
|
|
@ -5971,7 +6001,7 @@ const useSWRHandler = (_key, fetcher, config)=>{
|
|
|
|
|
currentConfig.onErrorRetry(err, key, currentConfig, (_opts)=>{
|
|
|
|
|
const revalidators = EVENT_REVALIDATORS[key];
|
|
|
|
|
if (revalidators && revalidators[0]) {
|
|
|
|
|
revalidators[0](_internal_index_mjs__WEBPACK_IMPORTED_MODULE_2__.h.ERROR_REVALIDATE_EVENT, _opts);
|
|
|
|
|
revalidators[0](_internal_index_mjs__WEBPACK_IMPORTED_MODULE_3__/* .ERROR_REVALIDATE_EVENT */ .aU, _opts);
|
|
|
|
|
}
|
|
|
|
|
}, {
|
|
|
|
|
retryCount: (opts.retryCount || 0) + 1,
|
|
|
|
|
@ -6006,11 +6036,11 @@ const useSWRHandler = (_key, fetcher, config)=>{
|
|
|
|
|
// `cache` isn't allowed to change during the lifecycle.
|
|
|
|
|
const boundMutate = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(// Use callback to make sure `keyRef.current` returns latest result every time
|
|
|
|
|
(...args)=>{
|
|
|
|
|
return (0,_internal_index_mjs__WEBPACK_IMPORTED_MODULE_2__.o)(cache, keyRef.current, ...args);
|
|
|
|
|
return (0,_internal_index_mjs__WEBPACK_IMPORTED_MODULE_2__.n)(cache, keyRef.current, ...args);
|
|
|
|
|
}, // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
|
|
|
[]);
|
|
|
|
|
// The logic for updating refs.
|
|
|
|
|
(0,_internal_index_mjs__WEBPACK_IMPORTED_MODULE_2__.v)(()=>{
|
|
|
|
|
(0,_internal_index_mjs__WEBPACK_IMPORTED_MODULE_2__.u)(()=>{
|
|
|
|
|
fetcherRef.current = fetcher;
|
|
|
|
|
configRef.current = config;
|
|
|
|
|
// Handle laggy data updates. If there's cached data of the current key,
|
|
|
|
|
@ -6020,31 +6050,31 @@ const useSWRHandler = (_key, fetcher, config)=>{
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
// After mounted or key changed.
|
|
|
|
|
(0,_internal_index_mjs__WEBPACK_IMPORTED_MODULE_2__.v)(()=>{
|
|
|
|
|
(0,_internal_index_mjs__WEBPACK_IMPORTED_MODULE_2__.u)(()=>{
|
|
|
|
|
if (!key) return;
|
|
|
|
|
const softRevalidate = revalidate.bind(_internal_index_mjs__WEBPACK_IMPORTED_MODULE_2__.U, WITH_DEDUPE);
|
|
|
|
|
// Expose revalidators to global event listeners. So we can trigger
|
|
|
|
|
// revalidation from the outside.
|
|
|
|
|
let nextFocusRevalidatedAt = 0;
|
|
|
|
|
const onRevalidate = (type, opts = {})=>{
|
|
|
|
|
if (type == _internal_index_mjs__WEBPACK_IMPORTED_MODULE_2__.h.FOCUS_EVENT) {
|
|
|
|
|
if (type == _internal_index_mjs__WEBPACK_IMPORTED_MODULE_3__/* .FOCUS_EVENT */ .N4) {
|
|
|
|
|
const now = Date.now();
|
|
|
|
|
if (getConfig().revalidateOnFocus && now > nextFocusRevalidatedAt && isActive()) {
|
|
|
|
|
nextFocusRevalidatedAt = now + getConfig().focusThrottleInterval;
|
|
|
|
|
softRevalidate();
|
|
|
|
|
}
|
|
|
|
|
} else if (type == _internal_index_mjs__WEBPACK_IMPORTED_MODULE_2__.h.RECONNECT_EVENT) {
|
|
|
|
|
} else if (type == _internal_index_mjs__WEBPACK_IMPORTED_MODULE_3__/* .RECONNECT_EVENT */ .l2) {
|
|
|
|
|
if (getConfig().revalidateOnReconnect && isActive()) {
|
|
|
|
|
softRevalidate();
|
|
|
|
|
}
|
|
|
|
|
} else if (type == _internal_index_mjs__WEBPACK_IMPORTED_MODULE_2__.h.MUTATE_EVENT) {
|
|
|
|
|
} else if (type == _internal_index_mjs__WEBPACK_IMPORTED_MODULE_3__/* .MUTATE_EVENT */ .QQ) {
|
|
|
|
|
return revalidate();
|
|
|
|
|
} else if (type == _internal_index_mjs__WEBPACK_IMPORTED_MODULE_2__.h.ERROR_REVALIDATE_EVENT) {
|
|
|
|
|
} else if (type == _internal_index_mjs__WEBPACK_IMPORTED_MODULE_3__/* .ERROR_REVALIDATE_EVENT */ .aU) {
|
|
|
|
|
return revalidate(opts);
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
};
|
|
|
|
|
const unsubEvents = (0,_internal_index_mjs__WEBPACK_IMPORTED_MODULE_3__/* .subscribeCallback */ .ko)(key, EVENT_REVALIDATORS, onRevalidate);
|
|
|
|
|
const unsubEvents = (0,_internal_index_mjs__WEBPACK_IMPORTED_MODULE_4__/* .subscribeCallback */ .ko)(key, EVENT_REVALIDATORS, onRevalidate);
|
|
|
|
|
// Mark the component as mounted and update corresponding refs.
|
|
|
|
|
unmountedRef.current = false;
|
|
|
|
|
keyRef.current = key;
|
|
|
|
|
@ -6055,13 +6085,13 @@ const useSWRHandler = (_key, fetcher, config)=>{
|
|
|
|
|
});
|
|
|
|
|
// Trigger a revalidation
|
|
|
|
|
if (shouldDoInitialRevalidation) {
|
|
|
|
|
if ((0,_internal_index_mjs__WEBPACK_IMPORTED_MODULE_2__.e)(data) || _internal_index_mjs__WEBPACK_IMPORTED_MODULE_2__.t) {
|
|
|
|
|
if ((0,_internal_index_mjs__WEBPACK_IMPORTED_MODULE_2__.e)(data) || _internal_index_mjs__WEBPACK_IMPORTED_MODULE_2__.r) {
|
|
|
|
|
// Revalidate immediately.
|
|
|
|
|
softRevalidate();
|
|
|
|
|
} else {
|
|
|
|
|
// Delay the revalidate if we have data to return so we won't block
|
|
|
|
|
// rendering.
|
|
|
|
|
(0,_internal_index_mjs__WEBPACK_IMPORTED_MODULE_2__.u)(softRevalidate);
|
|
|
|
|
(0,_internal_index_mjs__WEBPACK_IMPORTED_MODULE_2__.t)(softRevalidate);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return ()=>{
|
|
|
|
|
@ -6073,7 +6103,7 @@ const useSWRHandler = (_key, fetcher, config)=>{
|
|
|
|
|
key
|
|
|
|
|
]);
|
|
|
|
|
// Polling
|
|
|
|
|
(0,_internal_index_mjs__WEBPACK_IMPORTED_MODULE_2__.v)(()=>{
|
|
|
|
|
(0,_internal_index_mjs__WEBPACK_IMPORTED_MODULE_2__.u)(()=>{
|
|
|
|
|
let timer;
|
|
|
|
|
function next() {
|
|
|
|
|
// Use the passed interval
|
|
|
|
|
@ -6119,7 +6149,7 @@ const useSWRHandler = (_key, fetcher, config)=>{
|
|
|
|
|
// SWR should throw when trying to use Suspense on the server with React 18,
|
|
|
|
|
// without providing any fallback data. This causes hydration errors. See:
|
|
|
|
|
// https://github.com/vercel/swr/issues/1832
|
|
|
|
|
if (!_internal_index_mjs__WEBPACK_IMPORTED_MODULE_2__.I && _internal_index_mjs__WEBPACK_IMPORTED_MODULE_2__.t) {
|
|
|
|
|
if (!_internal_index_mjs__WEBPACK_IMPORTED_MODULE_2__.I && _internal_index_mjs__WEBPACK_IMPORTED_MODULE_2__.r) {
|
|
|
|
|
throw new Error('Fallback data is required when using Suspense in SSR.');
|
|
|
|
|
}
|
|
|
|
|
// Always update fetcher and config refs even with the Suspense mode.
|
|
|
|
|
@ -6142,7 +6172,7 @@ const useSWRHandler = (_key, fetcher, config)=>{
|
|
|
|
|
throw error;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return {
|
|
|
|
|
const swrResponse = {
|
|
|
|
|
mutate: boundMutate,
|
|
|
|
|
get data () {
|
|
|
|
|
stateDependencies.data = true;
|
|
|
|
|
@ -6161,6 +6191,7 @@ const useSWRHandler = (_key, fetcher, config)=>{
|
|
|
|
|
return isLoading;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
return swrResponse;
|
|
|
|
|
};
|
|
|
|
|
const SWRConfig = _internal_index_mjs__WEBPACK_IMPORTED_MODULE_2__.O.defineProperty(_internal_index_mjs__WEBPACK_IMPORTED_MODULE_2__.g, 'defaultValue', {
|
|
|
|
|
value: _internal_index_mjs__WEBPACK_IMPORTED_MODULE_2__.d
|
|
|
|
|
@ -6179,7 +6210,7 @@ const SWRConfig = _internal_index_mjs__WEBPACK_IMPORTED_MODULE_2__.O.definePrope
|
|
|
|
|
* return <div>hello {data.name}!</div>
|
|
|
|
|
* }
|
|
|
|
|
* ```
|
|
|
|
|
*/ const useSWR = (0,_internal_index_mjs__WEBPACK_IMPORTED_MODULE_3__/* .withArgs */ .s6)(useSWRHandler);
|
|
|
|
|
*/ const useSWR = (0,_internal_index_mjs__WEBPACK_IMPORTED_MODULE_4__/* .withArgs */ .s6)(useSWRHandler);
|
|
|
|
|
|
|
|
|
|
// useSWR
|
|
|
|
|
|