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/preview_functionality #13

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

c42alyst
Copy link

@c42alyst c42alyst commented Aug 21, 2023

What kind of change does this PR introduce?

Fixes Preview functionality

vercel#101
vercel#116

What is the current behavior?

  1. Wrong environment variable being requested and read before VERCEL_ENV instead of NEXT_PUBLIC_VERCEL_ENV
  2. API route not using the set token
  3. Token Dialog mount currently causes hydration errors due to differences in server and client renders (radix-ui issue)

What is the new behavior?

  1. Updated .env.example to indicate usage of NEXT_PUBLIC_VERCEL_ENV
  2. Updated the chat component to use NEXT_PUBLIC_VERCEL_ENV instead of VERCEL_ENV
  3. Mount the dialog in useEffect to avoid Nextjs hydration errors
  4. On component Unmount reset the token in localstorage
  5. Updated the chat route to use the preview token passed in the request body

New the preview functionality works by using a user provided Open AI API Key stored to localstorage and reset on exiting the page.

Additional context

Also added encoding library to avoid errors related to fetch
“Module not found: Can't resolve encoding”

@vercel
Copy link

vercel bot commented Aug 21, 2023

@c42alyst is attempting to deploy a commit to the Supabase Team on Vercel.

A member of the Team first needs to authorize it.

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.

1 participant