refactor: simplify Phase 1 infrastructure code
- cache-invalidation: extract isExpectedRevalidateError helper - integration-data-cache: flatten early-return chain, extract eviction - redis-handler: extract StoredEntry type, readStreamBody, ensureConnected - svg-purify: single getOwnPropertyDescriptor lookup per prop - session-scoped-providers: simplify auth flow - retryable-loader: use function declarations - translation/request: replace spread-in-reduce with for loop
This commit is contained in:
8 files changed
+148
-134
No files matched your search
@@ -1,7 +1,7 @@
|
||||
export const createRetryableLoader = <TKey, TValue>(loaders: ReadonlyMap<TKey, () => Promise<TValue>>) => {
|
||||
export function createRetryableLoader<TKey, TValue>(loaders: ReadonlyMap<TKey, () => Promise<TValue>>) {
|
||||
const promises = new Map<TKey, Promise<TValue>>();
|
||||
|
||||
return (key: TKey) => {
|
||||
return function load(key: TKey) {
|
||||
const existing = promises.get(key);
|
||||
if (existing) return existing;
|
||||
|
||||
@@ -15,4 +15,4 @@ export const createRetryableLoader = <TKey, TValue>(loaders: ReadonlyMap<TKey, (
|
||||
});
|
||||
return promise;
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user