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

feat: remove singleFetch flag #11522

Merged
merged 17 commits into from
May 9, 2024
Merged

feat: remove singleFetch flag #11522

merged 17 commits into from
May 9, 2024

Conversation

jacob-ebey
Copy link
Member

No description provided.

Copy link

changeset-bot bot commented May 2, 2024

🦋 Changeset detected

Latest commit: 6c1e2d8

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

This PR includes changesets to release 7 packages
Name Type
@react-router/server-runtime Major
react-router-dom Major
@react-router/express Major
react-router Major
@react-router/serve Major
@react-router/node Major
@react-router/dev 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

@@ -208,7 +208,9 @@ test.describe("loader in an app", async () => {
expect(await res.text()).toEqual("Partial");
});

test("should handle objects returned from resource routes", async ({
// TODO: Matt and I chatted about this recently, revisit that chat and
Copy link
Member Author

Choose a reason for hiding this comment

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

@brophdawg11 I'm disabling this and we can update / re-enable it after your PR goes in.

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah this should work after remix-run/remix#9349 is brought over - wanted to do that after this was merged to avoid conflicts

!(staticHandlerContext instanceof Response),
"Expected a context"
);
// TODO: figure out why this test exists
Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not sure why these exist but the underlying issue causing them to fail should probably be fixed.

Copy link
Contributor

Choose a reason for hiding this comment

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

These tests were from an issue a while back where IIRC the lack of a default export was being converted to export default {} in the compiler and that was causing us to think it had a component export and eventually call createElement({}) - so we strengthened our check for a component to make sure it was an actual react component. I don't specifically recall if they were esbuild only or also a vite thing though.

I got the tests passing and pushed it up

remix-run/remix#7593 (comment)
https://github.com/remix-run/remix/blob/main/packages/remix-react/routes.tsx#L614
remix-run/remix#7745

return `__remixContext.r(${JSON.stringify(routeId)}, ${JSON.stringify(
key
)}, ${escapeHtml(serializedData)})`;
};
Copy link
Contributor

Choose a reason for hiding this comment

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

😍

Comment on lines 289 to 296
? new URL(
reqUrl,
typeof window === "undefined"
? // TODO: Trace usage of singleFetchUrl and make sure we don't use it anywhere
// this will make it to a network call.
"server://singlefetch/"
: window.location.origin
)
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you recall what needed this? I removed it and things seem to be passing...

Since it's part of the DOM code it should always generally be running in a jsdom environment I think?

Copy link
Contributor

Choose a reason for hiding this comment

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

I removed this in d16ec89 - feel free to revert though if we need to keep it

Copy link
Contributor

Choose a reason for hiding this comment

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

found the one integration test that was failing - PrefetchPageLinks calls it during SSR so I added it back with a comment. The other 2 uses of it do result in a network call but both are in the browser so window will be available.

@@ -1,20 +1,73 @@
import type { EntryContext } from "@react-router/node";
import { PassThrough } from "node:stream";
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can just remove this file entirely and the condition that uses it in the remix dev and remix reveal code?

https://github.com/remix-run/react-router/blob/v7/packages/remix-dev/config.ts#L493
https://github.com/remix-run/react-router/blob/v7/packages/remix-dev/cli/commands.ts#L148

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah I see what you did - you got rid of the prohibitOutOfOrderStreaming check and just made the spa version always use handleBotRequest. IMO, it would be fine to just delete the SPA version and let npx remix reveal expose the default node one with the prohibitOutOfOrderStreaming check

Copy link
Contributor

Choose a reason for hiding this comment

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

Took a stab at that in dd6a86c - feel free to revert if we want to keep it 👍

Copy link
Contributor

Choose a reason for hiding this comment

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

hm - so that broke a handful of e2e tests so I reverted for now :)

}
} else {
statusCode = context.statusCode;
headers = getDocumentHeaders(build, context);
Copy link
Contributor

Choose a reason for hiding this comment

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

I also removed the now unused headers.ts file and the set-cookie-parser dependency in 531b286

@jacob-ebey jacob-ebey marked this pull request as ready for review May 9, 2024 18:47
@jacob-ebey jacob-ebey merged commit aab4ea0 into v7 May 9, 2024
8 checks passed
@jacob-ebey jacob-ebey deleted the remove_single_fetch_flag branch May 9, 2024 18:52
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.

None yet

2 participants