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

ENG-4592 feat(graphql,template): add environment handling graphql and example in template #969

Merged
merged 3 commits into from
Dec 9, 2024

Conversation

jonathanprozzi
Copy link
Member

Affected Packages

Apps

  • data populator
  • portal
  • template

Packages

  • 1ui
  • api
  • graphql
  • protocol
  • sdk

Tools

  • tools

Overview

  • Adds support for a configurable apiUrl for the GraphQL package. A configureClient is now exported along with API URLs as constants. Consuming apps can optionally call configureClient at the highest level of their app (such as root.tsx in Remix, layout.tsx in Next.js app router, or above the app configuration in an Express app).
  • The DEFAULT_API_URL in the package is currently set to dev for now.
  • This uses a similar configuration approach to Prisma and Apollo, such as: configureClient({ apiUrl: process.env.NODE_ENV === 'production' ? API_URL_PROD : API_URL_DEV, }) which has been added to the template's root.tsx as an example.
  • Note: If you're running Hasura locally you'll need to change the port that the template/Portal runs on.
  • Bumps the version of the GraphQL package.

Screen Captures

If applicable, add screenshots or screen captures of your changes.

Declaration

  • I hereby declare that I have abided by the rules and regulations as outlined in the CONTRIBUTING.md

… can support fully configurable apiUrl overrides similar to apollo and prisma -- bumps version and also exports API URLs as constants
Copy link

linear bot commented Dec 9, 2024

fetcher: '../client#fetcher',
fetcher: {
func: '../client#fetcher',
isReactHook: false,
Copy link
Member

Choose a reason for hiding this comment

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

is this only for fetcher? with this option do we still generate hooks?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's just for the fetcher. I ran codegen a few times since and we still have hooks but going to double check

@jonathanprozzi jonathanprozzi merged commit 3c97147 into main Dec 9, 2024
3 checks passed
@jonathanprozzi jonathanprozzi deleted the eng-4592-add-environment-handling-graphql branch December 9, 2024 22:56
jonathanprozzi added a commit that referenced this pull request Dec 9, 2024
- Brings in crucial parts of the most recent PRs into `main` so that we
can continue working on migrating to the new schema/architecture on the
`feature/graphql-migration` branch
- This includes the logic in #969 -- we'll want to review that first so
any changes can also be reflected in here. Including that logic will
make working with the local API/schema more direct since we can
configure the URL a bit easier.
- I'm reasonably sure that I got everything. We'll have to deal with
this again when we merge this branch into `main` but now that the
GraphQL package is published #969 should be the last PR until we merge
this feature branch in. If we change approaches we can modify the
feature branch accordingly
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat Feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants