-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Fix SPA mode when single fetch is enabled #9063
Conversation
🦋 Changeset detectedLatest commit: 1037483 The changes in this PR will be included in the next version bump. This PR includes changesets to release 16 packages
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 |
@@ -303,7 +303,8 @@ export async function generateEntry( | |||
let defaultEntryClient = path.resolve(defaultsDirectory, "entry.client.tsx"); | |||
let defaultEntryServer = path.resolve( | |||
defaultsDirectory, | |||
ctx?.remixConfig.ssr === false | |||
ctx?.remixConfig.ssr === false && | |||
ctx?.remixConfig.future.unstable_singleFetch !== true |
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.
Reveal the streaming entry.server
in SPA mode when single fetch is enabled.
I wonder if there's any good way to detect if a user is currently using renderToString
in their own entry.server
and they flip on single fetch. From what I recall the error isn't super obvious and React sticks it in a <template>
at the end of the HTML but no console errors get logged.
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.
@jacob-ebey is going to look into a check at built time for this using the entry.server
AST (separate PR)
@@ -469,7 +469,7 @@ export async function resolveConfig( | |||
let pkgJson = await PackageJson.load(rootDirectory); | |||
let deps = pkgJson.content.dependencies ?? {}; | |||
|
|||
if (isSpaMode) { | |||
if (isSpaMode && appConfig.future?.unstable_singleFetch != true) { |
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.
Default to the streaming entry server in SPA mode w/singleFetch if the user doesn't have an entry.server
We can't use
renderToString
when single fetch is enabled, so don't default to (or reveal)entry.server.spa.tsx
in SPA mode if single fetch is enabled.I also removed the
entry.server.tsx
file fromtemplates/spa
since there's no need for the user to customize it like there may be in non-SPA templates.