UNPKG

use-async-resource

Version:

A custom React hook for simple data fetching with React Suspense

20 lines 674 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.updateCache = void 0; const cache_1 = require("./cache"); const dataReaderInitializer_1 = require("./dataReaderInitializer"); function updateCache(apiFn, ...parameters) { (0, cache_1.resourceCache)(apiFn).delete(...parameters); const updateResource = (0, dataReaderInitializer_1.initializeDataReader)(apiFn, ...parameters); try { updateResource(); } catch (p) { if ('then' in p) { return p; } } throw Error(`Cannot update cache for ${apiFn.name}`); } exports.updateCache = updateCache; //# sourceMappingURL=updateCache.js.map