-
-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
wip: initial fetchStrategy #11001
wip: initial fetchStrategy #11001
Conversation
|
@@ -339,6 +339,23 @@ export type HydrationState = Partial< | |||
Pick<RouterState, "loaderData" | "actionData" | "errors"> | |||
>; | |||
|
|||
export interface DefaultCallLoaderOrActionFunction { | |||
( | |||
type: "loader" | "action", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this need to call actions? I've been envisioning this as a loader-only concept
import { json } from "../index"; | ||
import { cleanup, setup } from "./utils/data-router-setup"; | ||
import { createFormData } from "./utils/utils"; | ||
|
||
let fetchStrategy: FetchStrategy; | ||
beforeEach(() => { | ||
fetchStrategy = jest.fn( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to provide the default and update all the existing tests? Since fetchStrategy
will be a net-new optional prop, I think we should be able to leave all existing tests untouched and then add a few tests that set it accordingly?
describe('fetchStrategy', () => {
it('fetches in parallel if no fetchStrategy is provided', ...);
it('allows users to re-implement the default parallel fetching via Promise.all/defaultCallLoader', ...);
it('allows users to implement a custom fetch strategy (single-fetch)', ...);
it('allows users to implement a custom fetch strategy (composing gql fragments from handle)', ...);
});
Superseded by #11098 |
No description provided.