Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split Cache into its own Dispatcher #25474

Merged
merged 3 commits into from
Oct 13, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Missing Hooks
  • Loading branch information
sebmarkbage committed Oct 12, 2022
commit abb01789fc7dcade9686e15bffde0ebf3e0a6828
7 changes: 5 additions & 2 deletions packages/react-server/src/ReactFizzHooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,9 +274,11 @@ export function resetHooksState(): void {
workInProgressHook = null;
}

function getCacheSignal(): AbortSignal {
throw new Error('Not implemented.');
}

function getCacheForType<T>(resourceType: () => T): T {
// TODO: This should silently mark this as client rendered since it's not necessarily
// considered an error. It needs to work for things like Flight though.
throw new Error('Not implemented.');
}

Expand Down Expand Up @@ -702,6 +704,7 @@ export const Dispatcher: DispatcherType = {
};

if (enableCache) {
Dispatcher.getCacheSignal = getCacheSignal;
Dispatcher.getCacheForType = getCacheForType;
Dispatcher.useCacheRefresh = useCacheRefresh;
}
Expand Down
3 changes: 3 additions & 0 deletions packages/react-server/src/ReactFlightHooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ export const Dispatcher: DispatcherType = {
useDebugValue(): void {},
useDeferredValue: (unsupportedHook: any),
useTransition: (unsupportedHook: any),
getCacheSignal(): AbortSignal {
throw new Error('Not implemented.');
},
getCacheForType<T>(resourceType: () => T): T {
if (!currentCache) {
throw new Error('Reading the cache is only supported while rendering.');
Expand Down