Files
GNX-mailEnterprise/frontend/node_modules/.cache/babel-loader/787fcb95f170cd37307f87ef41c0df8b0f221fe5069bfac1c968b01395f8e1c3.json
Iliyan Angelov 9454b6ae19 update
2025-09-22 20:29:41 +03:00

1 line
12 KiB
JSON

{"ast":null,"code":"import React from 'react';\nimport { notifyManager } from '../core/notifyManager';\nimport { useQueryErrorResetBoundary } from './QueryErrorResetBoundary';\nimport { useQueryClient } from './QueryClientProvider';\nimport { shouldThrowError } from './utils';\nexport function useBaseQuery(options, Observer) {\n var mountedRef = React.useRef(false);\n var _React$useState = React.useState(0),\n forceUpdate = _React$useState[1];\n var queryClient = useQueryClient();\n var errorResetBoundary = useQueryErrorResetBoundary();\n var defaultedOptions = queryClient.defaultQueryObserverOptions(options); // Make sure results are optimistically set in fetching state before subscribing or updating options\n\n defaultedOptions.optimisticResults = true; // Include callbacks in batch renders\n\n if (defaultedOptions.onError) {\n defaultedOptions.onError = notifyManager.batchCalls(defaultedOptions.onError);\n }\n if (defaultedOptions.onSuccess) {\n defaultedOptions.onSuccess = notifyManager.batchCalls(defaultedOptions.onSuccess);\n }\n if (defaultedOptions.onSettled) {\n defaultedOptions.onSettled = notifyManager.batchCalls(defaultedOptions.onSettled);\n }\n if (defaultedOptions.suspense) {\n // Always set stale time when using suspense to prevent\n // fetching again when directly mounting after suspending\n if (typeof defaultedOptions.staleTime !== 'number') {\n defaultedOptions.staleTime = 1000;\n } // Set cache time to 1 if the option has been set to 0\n // when using suspense to prevent infinite loop of fetches\n\n if (defaultedOptions.cacheTime === 0) {\n defaultedOptions.cacheTime = 1;\n }\n }\n if (defaultedOptions.suspense || defaultedOptions.useErrorBoundary) {\n // Prevent retrying failed query if the error boundary has not been reset yet\n if (!errorResetBoundary.isReset()) {\n defaultedOptions.retryOnMount = false;\n }\n }\n var _React$useState2 = React.useState(function () {\n return new Observer(queryClient, defaultedOptions);\n }),\n observer = _React$useState2[0];\n var result = observer.getOptimisticResult(defaultedOptions);\n React.useEffect(function () {\n mountedRef.current = true;\n errorResetBoundary.clearReset();\n var unsubscribe = observer.subscribe(notifyManager.batchCalls(function () {\n if (mountedRef.current) {\n forceUpdate(function (x) {\n return x + 1;\n });\n }\n })); // Update result to make sure we did not miss any query updates\n // between creating the observer and subscribing to it.\n\n observer.updateResult();\n return function () {\n mountedRef.current = false;\n unsubscribe();\n };\n }, [errorResetBoundary, observer]);\n React.useEffect(function () {\n // Do not notify on updates because of changes in the options because\n // these changes should already be reflected in the optimistic result.\n observer.setOptions(defaultedOptions, {\n listeners: false\n });\n }, [defaultedOptions, observer]); // Handle suspense\n\n if (defaultedOptions.suspense && result.isLoading) {\n throw observer.fetchOptimistic(defaultedOptions).then(function (_ref) {\n var data = _ref.data;\n defaultedOptions.onSuccess == null ? void 0 : defaultedOptions.onSuccess(data);\n defaultedOptions.onSettled == null ? void 0 : defaultedOptions.onSettled(data, null);\n }).catch(function (error) {\n errorResetBoundary.clearReset();\n defaultedOptions.onError == null ? void 0 : defaultedOptions.onError(error);\n defaultedOptions.onSettled == null ? void 0 : defaultedOptions.onSettled(undefined, error);\n });\n } // Handle error boundary\n\n if (result.isError && !errorResetBoundary.isReset() && !result.isFetching && shouldThrowError(defaultedOptions.suspense, defaultedOptions.useErrorBoundary, [result.error, observer.getCurrentQuery()])) {\n throw result.error;\n } // Handle result property usage tracking\n\n if (defaultedOptions.notifyOnChangeProps === 'tracked') {\n result = observer.trackResult(result, defaultedOptions);\n }\n return result;\n}","map":{"version":3,"names":["React","notifyManager","useQueryErrorResetBoundary","useQueryClient","shouldThrowError","useBaseQuery","options","Observer","mountedRef","useRef","_React$useState","useState","forceUpdate","queryClient","errorResetBoundary","defaultedOptions","defaultQueryObserverOptions","optimisticResults","onError","batchCalls","onSuccess","onSettled","suspense","staleTime","cacheTime","useErrorBoundary","isReset","retryOnMount","_React$useState2","observer","result","getOptimisticResult","useEffect","current","clearReset","unsubscribe","subscribe","x","updateResult","setOptions","listeners","isLoading","fetchOptimistic","then","_ref","data","catch","error","undefined","isError","isFetching","getCurrentQuery","notifyOnChangeProps","trackResult"],"sources":["/home/gnx/Desktop/GNX-mailEnterprise/frontend/node_modules/react-query/es/react/useBaseQuery.js"],"sourcesContent":["import React from 'react';\nimport { notifyManager } from '../core/notifyManager';\nimport { useQueryErrorResetBoundary } from './QueryErrorResetBoundary';\nimport { useQueryClient } from './QueryClientProvider';\nimport { shouldThrowError } from './utils';\nexport function useBaseQuery(options, Observer) {\n var mountedRef = React.useRef(false);\n\n var _React$useState = React.useState(0),\n forceUpdate = _React$useState[1];\n\n var queryClient = useQueryClient();\n var errorResetBoundary = useQueryErrorResetBoundary();\n var defaultedOptions = queryClient.defaultQueryObserverOptions(options); // Make sure results are optimistically set in fetching state before subscribing or updating options\n\n defaultedOptions.optimisticResults = true; // Include callbacks in batch renders\n\n if (defaultedOptions.onError) {\n defaultedOptions.onError = notifyManager.batchCalls(defaultedOptions.onError);\n }\n\n if (defaultedOptions.onSuccess) {\n defaultedOptions.onSuccess = notifyManager.batchCalls(defaultedOptions.onSuccess);\n }\n\n if (defaultedOptions.onSettled) {\n defaultedOptions.onSettled = notifyManager.batchCalls(defaultedOptions.onSettled);\n }\n\n if (defaultedOptions.suspense) {\n // Always set stale time when using suspense to prevent\n // fetching again when directly mounting after suspending\n if (typeof defaultedOptions.staleTime !== 'number') {\n defaultedOptions.staleTime = 1000;\n } // Set cache time to 1 if the option has been set to 0\n // when using suspense to prevent infinite loop of fetches\n\n\n if (defaultedOptions.cacheTime === 0) {\n defaultedOptions.cacheTime = 1;\n }\n }\n\n if (defaultedOptions.suspense || defaultedOptions.useErrorBoundary) {\n // Prevent retrying failed query if the error boundary has not been reset yet\n if (!errorResetBoundary.isReset()) {\n defaultedOptions.retryOnMount = false;\n }\n }\n\n var _React$useState2 = React.useState(function () {\n return new Observer(queryClient, defaultedOptions);\n }),\n observer = _React$useState2[0];\n\n var result = observer.getOptimisticResult(defaultedOptions);\n React.useEffect(function () {\n mountedRef.current = true;\n errorResetBoundary.clearReset();\n var unsubscribe = observer.subscribe(notifyManager.batchCalls(function () {\n if (mountedRef.current) {\n forceUpdate(function (x) {\n return x + 1;\n });\n }\n })); // Update result to make sure we did not miss any query updates\n // between creating the observer and subscribing to it.\n\n observer.updateResult();\n return function () {\n mountedRef.current = false;\n unsubscribe();\n };\n }, [errorResetBoundary, observer]);\n React.useEffect(function () {\n // Do not notify on updates because of changes in the options because\n // these changes should already be reflected in the optimistic result.\n observer.setOptions(defaultedOptions, {\n listeners: false\n });\n }, [defaultedOptions, observer]); // Handle suspense\n\n if (defaultedOptions.suspense && result.isLoading) {\n throw observer.fetchOptimistic(defaultedOptions).then(function (_ref) {\n var data = _ref.data;\n defaultedOptions.onSuccess == null ? void 0 : defaultedOptions.onSuccess(data);\n defaultedOptions.onSettled == null ? void 0 : defaultedOptions.onSettled(data, null);\n }).catch(function (error) {\n errorResetBoundary.clearReset();\n defaultedOptions.onError == null ? void 0 : defaultedOptions.onError(error);\n defaultedOptions.onSettled == null ? void 0 : defaultedOptions.onSettled(undefined, error);\n });\n } // Handle error boundary\n\n\n if (result.isError && !errorResetBoundary.isReset() && !result.isFetching && shouldThrowError(defaultedOptions.suspense, defaultedOptions.useErrorBoundary, [result.error, observer.getCurrentQuery()])) {\n throw result.error;\n } // Handle result property usage tracking\n\n\n if (defaultedOptions.notifyOnChangeProps === 'tracked') {\n result = observer.trackResult(result, defaultedOptions);\n }\n\n return result;\n}"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,aAAa,QAAQ,uBAAuB;AACrD,SAASC,0BAA0B,QAAQ,2BAA2B;AACtE,SAASC,cAAc,QAAQ,uBAAuB;AACtD,SAASC,gBAAgB,QAAQ,SAAS;AAC1C,OAAO,SAASC,YAAYA,CAACC,OAAO,EAAEC,QAAQ,EAAE;EAC9C,IAAIC,UAAU,GAAGR,KAAK,CAACS,MAAM,CAAC,KAAK,CAAC;EAEpC,IAAIC,eAAe,GAAGV,KAAK,CAACW,QAAQ,CAAC,CAAC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