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

fix(react): fix useLoaderData types in Yarn PnP #7137

Merged
merged 3 commits into from Aug 14, 2023

Conversation

markdalgleish
Copy link
Member

@markdalgleish markdalgleish commented Aug 11, 2023

Fixes #6994

The useLoaderData return type depends on access to the SerializeFrom type exported by @remix-run/server-runtime. Since this package is listed as a dev dependency of @remix-run/react rather than a regular dependency, this type isn't currently available to consumers when running Yarn PnP.

@markdalgleish markdalgleish added bug Something isn't working renderer:react pm:yarn3 Bugs related to Yarn 3 v2 Issues related to v2 apis labels Aug 11, 2023
@markdalgleish markdalgleish self-assigned this Aug 11, 2023
@changeset-bot
Copy link

changeset-bot bot commented Aug 11, 2023

🦋 Changeset detected

Latest commit: 48329d8

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

This PR includes changesets to release 16 packages
Name Type
@remix-run/react Patch
@remix-run/testing Patch
create-remix Patch
remix Patch
@remix-run/architect Patch
@remix-run/cloudflare Patch
@remix-run/cloudflare-pages Patch
@remix-run/cloudflare-workers Patch
@remix-run/css-bundle Patch
@remix-run/deno Patch
@remix-run/dev Patch
@remix-run/eslint-config Patch
@remix-run/express Patch
@remix-run/node Patch
@remix-run/serve Patch
@remix-run/server-runtime Patch

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

@MichaelDeBoey
Copy link
Member

This feels very weird to do so and makes me think about the initiative @pcattori started at some point to look into extracting certain packages

I think back then the decision was made to copy/paste certain types and maintain 2 versions of it (for now)

Maybe we should either do that here as well or since it's v2 it can be a perfect time to restart the initiative as well 🤔

@markdalgleish
Copy link
Member Author

markdalgleish commented Aug 14, 2023

I chatted offline with @MichaelDeBoey, but just updating here too.

My feeling is that this is okay as a short-term fix since it's not changing any of the relationships between the packages — it's simply fixing an issue where @remix-run/react/package.json is out of sync with reality. I agree that it's a good idea to revisit the current architecture at some point, but I don't think it needs to hold up this fix in the meantime. We could duplicate the SerializeFrom type to avoid the server-runtime dependency, but I think that will make refactoring harder in the future, and including it as a dependency doesn't seem to have any down side from a consumer's perspective.

@pcattori
Copy link
Contributor

My feeling is that this is okay as a short-term fix since it's not changing any of the relationships between the packages — it's simply fixing an issue where @remix-run/react/package.json is out of sync with reality. I agree that it's a good idea to revisit the current architecture at some point, but I don't think it needs to hold up this fix in the meantime. We could duplicate the SerializeFrom type to avoid the server-runtime dependency, but I think that will make refactoring harder in the future, and including it as a dependency doesn't seem to have any down side from a consumer's perspective.

I agree. Originally, the package reorg work was going to happen early this year, but we deprioritized it since it would be a breaking change, plus we wanted to focus on HMR/HDR work. Let's add @remix-run/server-runtime back as a dependency and we can clean it up when we tackle package reorg in v2.

@markdalgleish markdalgleish merged commit 65fdbcd into dev Aug 14, 2023
9 checks passed
@markdalgleish markdalgleish deleted the markdalgleish/fix-useloaderdata-types-yarn-pnp branch August 14, 2023 22:11
@github-actions github-actions bot added the awaiting release This issue has been fixed and will be released soon label Aug 14, 2023
@github-actions
Copy link
Contributor

🤖 Hello there,

We just published version v0.0.0-nightly-65fdbcd-20230815 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
Labels
awaiting release This issue has been fixed and will be released soon bug Something isn't working CLA Signed pm:yarn3 Bugs related to Yarn 3 renderer:react v2 Issues related to v2 apis
Projects
No open projects
Status: Merged
Development

Successfully merging this pull request may close these issues.

None yet

3 participants