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

Add client utils to app router package #1659

Merged
merged 21 commits into from
Nov 29, 2023
Merged

Conversation

blakewilson
Copy link
Contributor

@blakewilson blakewilson commented Nov 17, 2023

Tasks

  • I have signed a Contributor License Agreement (CLA) with WP Engine.
  • If a code change, I have written testing instructions that the whole team & outside contributors can understand.
  • I have written and included a comprehensive changeset to properly document the changes I've made.

Description

This PR introduces a mechanism to make GraphQL requests on the client side within a Faust app router project. In order to do so, the <FaustProvider> component was brought back and can be imported via:

import { FaustProvider } from '@faustwp/experimental-app-router/ssr';

This PR also sets us up to use package exports so we can better isolate our RSC and SSR implementations.

Related Issue(s):

Testing

  1. Checkout the PR
  2. install deps (npm install)
  3. Build the packages (npm run build -w @faustwp/experimental-app-router)
  4. Run the example project (npm run dev -w @faustwp/app-router-example)
  5. Navigate to http://localhost:3000/making-client-queries and notice the client query works properly.
  6. Ensure other data fetching methods work as well (RSC data fetching, previews, etc).
  7. Try to break it!

Screenshots

Bundle size is not effected outside of client data fetching.

Bundle before this PR:
Screenshot 2023-11-27 at 10 45 45 AM

Bundle after:
Screenshot 2023-11-27 at 10 39 07 AM

Documentation Changes

Dependant PRs

Copy link

changeset-bot bot commented Nov 17, 2023

🦋 Changeset detected

Latest commit: a13412e

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

This PR includes changesets to release 1 package
Name Type
@faustwp/experimental-app-router 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

Copy link
Contributor

github-actions bot commented Nov 17, 2023

📦 Next.js Bundle Analysis for @faustwp/getting-started-example

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

@josephfusco josephfusco added the package: @faustwp/experimental-app-router Related to the experimental app router package label Nov 17, 2023
@blakewilson blakewilson marked this pull request as ready for review November 27, 2023 17:32
@blakewilson blakewilson requested a review from a team as a code owner November 27, 2023 17:32
Comment on lines +16 to +17
"module": "ESNext",
"moduleResolution": "Bundler",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

In order to use package exports in TypeScript, you must set moduleResolution to Node16, NodeNext, or Bundler. Since we don't want to enforce strict module resolution with file extensions, etc. on our users, we use Bundler since the other two require that strict behavior.

@theodesp
Copy link
Member

LGTM. It looks like there is a dependency check failure.

@blakewilson
Copy link
Contributor Author

LGTM. It looks like there is a dependency check failure.

Fixed!

@blakewilson blakewilson merged commit 626207b into canary Nov 29, 2023
18 checks passed
@blakewilson blakewilson deleted the app-router-client-utils branch November 29, 2023 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: @faustwp/experimental-app-router Related to the experimental app router package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants