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: Vite inline prisma values #1110

Merged
merged 5 commits into from
May 21, 2024

Conversation

jacobparis
Copy link
Contributor

Using the Vite dev server, client side navigations are inexplicably failing when trying to navigate to a page which imports (either directly or indirectly) any schema values from @trigger.dev/database and uses them for actual code. Importing and using them as types seems to be ok, and importing the prisma package also works.

I've tested using prisma-zod-types and importing those results instead, with the same issue.

On occasion I can get it to show an error message, which looks like @trigger.dev/database does not provide an export TaskRunStatus as if the prisma client hadn't been generated. However VS Code can resolve the types fine, and it works on SSR as well. I'm not sure if this error is at the pnpm layer or with Vite directly, or possibly part of the way it optimizes dependencies doesn't work with prisma's codegen over pnpm's symlinks. Lots of moving parts here.

This PR unblocks the process by finding every place in the webapp where the prisma client is used at runtime and inlining the values. There's a fair bit of duplication here because I kept each one to its own file. We could find a real home for these but I'd consider this a temporary solution at the moment until Vite gets sorted out.

Closes #

✅ Checklist

  • I have followed every step in the contributing guide
  • The PR title follows the convention.
  • I ran and tested the code works

Testing

[Describe the steps you took to test this change]


Changelog

[Short description of what has changed]


Screenshots

[Screenshots]

💯

Copy link

changeset-bot bot commented May 18, 2024

⚠️ No Changeset found

Latest commit: 0a7ad23

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@ericallam ericallam merged commit 05d3b08 into triggerdotdev:main May 21, 2024
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants