Skip to content

Add config option to disable lazy route discovery #13451

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

Merged
merged 9 commits into from
Apr 28, 2025

Conversation

brophdawg11
Copy link
Contributor

@brophdawg11 brophdawg11 commented Apr 23, 2025

Closes #12656
Closes #12767

@brophdawg11 brophdawg11 linked an issue Apr 23, 2025 that may be closed by this pull request
Copy link

changeset-bot bot commented Apr 24, 2025

🦋 Changeset detected

Latest commit: 81ac2da

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 11 packages
Name Type
@react-router/dev Major
react-router Major
@react-router/fs-routes Major
@react-router/remix-routes-option-adapter Major
@react-router/architect Major
@react-router/cloudflare Major
react-router-dom Major
@react-router/express Major
@react-router/node Major
@react-router/serve Major
create-react-router Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@brophdawg11 brophdawg11 force-pushed the brophdawg11/disable-fow branch from 2470cb5 to 1766db9 Compare April 24, 2025 16:06
version: "",
},
};
let context = mockFrameworkContext();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added some helpers for these things so we can add new fields in one spot and not have to go around and touch all tests that mock out a context

import { createRequestHandler } from "../../lib/server-runtime/server";
import { mockServerBuild } from "./utils";
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated tests to use this existing utility which now includes the routeDiscovery config

} = {}
) {
): ServerBuild {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now strongly typed so we know we have all fields

future: FutureConfig;
ssr: boolean;
isSpaMode: boolean;
export type WindowReactRouterContext = ServerHandoff & {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that we collapsed @remix-run/react and @remix-run/server-runtime we can share some of these types better. The window context is exactly the server handoff plus the state/stream stuff we append to it after the fact

Comment on lines -14 to -19
// The number of active deferred keys rendered on the server
a?: number;
dev?: {
port?: number;
hmrRuntime?: string;
};
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused in the repo. I believe a was from the defer implementation and I think the dev stuff was from the classic compiler?

let entryContext: EntryContext = {
manifest: build.assets,
routeModules: createEntryRouteModules(build.routes),
staticHandlerContext: context,
criticalCss,
serverHandoffString: createServerHandoffString({
basename: build.basename,
...baseServerHandoff,
criticalCss,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

criticalCss is the only thing we add to the handoff on the first render pass

Comment on lines -5 to -14
type ValidateShape<T, Shape> =
// If it extends T
T extends Shape
? // and there are no leftover props after removing the base
Exclude<keyof T, keyof Shape> extends never
? // we are good
T
: // otherwise it's either too many or too few props
never
: never;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No longer needed because state is never included in the handoff string now - that was leftover from pre-turbo-stream

Copy link
Contributor

github-actions bot commented May 8, 2025

🤖 Hello there,

We just published version 7.6.0 which includes this pull request. If you'd like to take it for a test run please try it out and let us know what you think!

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RR7 lazyRouteDiscover (Fog of War) opt-out
1 participant