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: no-cookies-for-cc #1723

Merged
merged 6 commits into from
Jan 15, 2024
Merged

fix: no-cookies-for-cc #1723

merged 6 commits into from
Jan 15, 2024

Conversation

juliusmarminge
Copy link
Member

@juliusmarminge juliusmarminge commented Jan 12, 2024

This will break authenticated requests made during SSR from CCs. To avoid issues you must therefore pass the server data as props and add it as initialData :/

Let me repeat, useSuspenseQuery will not work with this, as your client components will not have the required headers to make authenticated requests

Copy link

changeset-bot bot commented Jan 12, 2024

🦋 Changeset detected

Latest commit: a93a2c9

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

This PR includes changesets to release 1 package
Name Type
create-t3-app 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

vercel bot commented Jan 12, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
create-t3-app ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 15, 2024 7:41pm
t3-upgrade ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 15, 2024 7:41pm

@juliusmarminge
Copy link
Member Author

Current dependencies on/for this PR:

This stack of pull requests is managed by Graphite.

Copy link
Contributor

github-actions bot commented Jan 12, 2024

⚡️ Lighthouse report for the changes in this PR:

Category Score
🟢 Performance 98
🟢 Accessibility 91
🟢 Best practices 100
🟢 SEO 100
🔴 PWA 30

Lighthouse ran on https://create-t3-app-git-01-12-no-cookies-for-cc-t3-oss.vercel.app/

import Link from "next/link";

import { CreatePost } from "~/app/_components/create-post";
import { getServerAuthSession } from "~/server/auth";
import { api } from "~/trpc/server";

export default async function Home() {
dynamic();
Copy link
Member Author

Choose a reason for hiding this comment

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

no idea why it's not inferring this apge as dynamic from the trpc call (which calls cookies/headers etc..

Copy link
Contributor

A new create-t3-app prerelease is available for testing. You can install this latest build in your project with:

pnpm create [email protected]

@github-actions github-actions bot removed the 🚀 autorelease add this label to a pr to trigger a beta release label Jan 12, 2024
@juliusmarminge juliusmarminge marked this pull request as ready for review January 12, 2024 15:18
@@ -46,7 +47,7 @@ export const authOptions: NextAuthOptions = {
},
}),
},
adapter: DrizzleAdapter(db, mysqlTable),
adapter: DrizzleAdapter(db, mysqlTable) as Adapter,
Copy link
Member Author

Choose a reason for hiding this comment

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

@c-ehrlich c-ehrlich added this pull request to the merge queue Jan 15, 2024
Merged via the queue into main with commit c116281 Jan 15, 2024
76 checks passed
@c-ehrlich c-ehrlich deleted the 01-12-no-cookies-for-cc branch January 15, 2024 20:25
vyductan added a commit to vyductan/VyDucTan.Dev that referenced this pull request Feb 14, 2024
vyductan added a commit to vyductan/VyDucTan.Dev that referenced this pull request Feb 16, 2024
* feat(openai): create page translate

* fix(app): delete old yarn, to use pnpm

* fix(app): upload nessesary component

* fix(app): temp delete page english

* fix(app): delete some error

* fix(app): fix build error

* feat(components): create Form Component

* feat(components): create Input component

* feat(components): create Popover component

* feat(components): create Tooltip component

* feat(api): creat server action handle

* feat(pages): create blog page

* feat(api): create tprc api

* feat(api): create nextauth api

* refactor(pages)!: change form of contact to serverAction

* refactor(pages): move from pages folder to app dir

* chore(app): fix all error to use translate page

* fix(app): upload remaining

* fix(app): fix PrismaClientInitializationError

* fix(styles): fix color brand (changed to primary)

* feat(app): add eslint plugin for tailwind

* feat(components): add xl size

* refactor(pages): font size of translate page to larger (x)

* fix(app): twin.marco support

* refactor(translate): improve server response

* feat(chatgpt): create new

* feat(app): update layout

* feat(app): creat chatgpt app dỉ

* chore: Backup all code before upgrade

* chore: remove old @vyductan

* chore: befor update AI

* chore:

* chore: update @vyductan

* move

* update Submodule

* feat(chat): update styles

* feat: auth

* feat: setup multiple platform

* fix: Dependency {any} has multiple versions defined in the workspace

* fix(db): primaryKey is deprecated

* feat(english): db schema

* feat(english): db types

* fix(db): update to use t3-env

* feat!: move db and auth package to api package

* WIP

* fix(translate/page.tsx): fix comment syntax error in the code
feat(translate/page.tsx): update translation instructions for mode === Mode.to_vietnamese to include additional requirements

* chore(dashboard): remove unused EnglishPage component

* chore(english): remove unused files and code related to English vocabulary management
feat(english): add form to add new word definitions to the English vocabulary
feat(englishh): add table to display existing word definitions in the English vocabulary

* chore(server-action): remove server-action package

The server-action package has been removed from the project. This commit removes all related files and configurations associated with the server-action package. The package was no longer needed and was causing unnecessary complexity in the codebase. Removing it simplifies the project structure and reduces the overall maintenance burden.

* chore(ui): remove unused files and dependencies

The following files were deleted:
- `Form.tsx`
- `FormItem.tsx`
- `context.tsx`
- `index.ts`
- `types.ts`
- `useForm.tsx_`
- `utils.ts`
- `PageContainer.tsx`

The following dependencies were removed:
- `@vyductan/server-action`

* feat(next.config.js): add next.config.js file to configure Next.js app
feat(next.config.js): enable bundle analyzer when ANALYZE environment variable is set to true
feat(next.config.js): enable experimental optimizePackageImports feature for specified packages
feat(next.config.js): configure images domains for Next.js app
feat(next.config.js): enable transpilation for specified packages without a build step
feat(next.config.js): configure TypeScript options to ignore build errors
feat(next.config.js): add withBundleAnalyzer higher-order function to enable bundle analyzer
feat(next.config.js): add rewrites for specific API routes
feat(next.config.js): add experimental webpack configuration options
feat(next.config.js): add eslint configuration to ignore linting during builds
feat(next.config.js): add dotenv-cli as a dev dependency for environment variable management
feat(next.config.js): add postcss-replace as a dev dependency for postcss configuration
feat(next.config.js): update dependencies to latest versions
fix(layout.tsx): fix import statement for ReactNode type
feat(create.project.tsx): add CreateProjectForm component to handle project creation
feat(table.projects.tsx): add WordTable component to display projects in a table
feat(page.tsx): add TodoPage component to display projects page
feat(env.js): add env.js file to handle environment variables configuration

* feat(tts): add support for EdgeTTS provider for text-to-speech functionality

feat(tts): implement the `speak` function for the EdgeTTS provider

feat(tts): implement the `doSpeak` function for the EdgeTTS provider

feat(tts): add `langCode2TTSLang` mapping for language codes to TTS language codes

feat(tts): add `defaultTTSProvider` constant for the default TTS provider

feat(tts): add `fetchEdgeVoices` function to fetch available voices from the EdgeTTS provider

feat(tts): add `DoSpeakOptions` interface for the options of the `doSpeak` function

feat(tts): add `SpeakOptions` interface for the options of the `speak` function

feat(tts): add `TTSProvider` type for the TTS provider options in the `doSpeak` function

fix(tts): fix the `lang` parameter in the `doSpeak` function to be of type `LangCode`

fix(tts): fix the `lang` parameter in the `speak` function to be optional

fix(tts): fix the `onFinish` parameter in the `doSpeak` function to be optional

fix(tts): fix the `onStartSpeaking` parameter in the `doSpeak` function to be optional

fix(tts): fix the `onFinish` parameter in the `speak` function to be optional

fix(tts): fix the `onStartSpeaking` parameter in the `speak` function to be optional

fix(tts): fix the `voice` parameter in the `doSpeak` function to be optional

fix(tts): fix the `voice` parameter in the `speak` function to be optional

fix(tts): fix the `rate` parameter in the `doSpeak` function to be optional

fix(tts): fix the `rate` parameter in the `speak` function to be optional

fix(tts): fix the `volume` parameter in the `doSpeak` function to be optional

fix(tts): fix the `volume` parameter in the `speak` function to be optional

* refactor(router.ts): remove commented out code to improve code readability and maintainability
refactor(types.ts): remove unused type AddWordDefinitionParams to declutter the codebase

* refactor(trpc): simplify errorFormatter function using arrow function syntax for better readability
feat(trpc): export protectedProcedure as a separate procedure for enforcing authentication before running the procedure

* fix(projects/router.ts): import correct dependencies and remove unnecessary comments
feat(router.ts): add support for retrieving project by slug and its tasks
fix(schema.ts): add slug field to projects table and add status field to tasks table
feat(types.ts): add types for project tasks and create insertTaskSchema

* chore(.nvmrc): update Node.js version from 18.18.2 to 20.10.0
chore(@vyductan): update subproject commit hash from f99f5cc to 5cbb864
docs(README.md): update latest commit link to t3-oss/create-t3-turbo@a7b639f
chore(@vyductan/ui): update package name from "@vyductan/ui" to "@vyductan/ui_"

* fix(signin/page.tsx): update import paths for signIn function and Button component to match new package structure
feat(signin/page.tsx): refactor form action to use formAction prop on Button component for better readability and maintainability

* refactor(UserNav): update import statements to use the correct package names for Session and Dropdown components

* feat(english-list): add SpeakerIcon component to display a speaker icon next to each word in the table
fix(english-form): fix import path for RadioOption from "@vyductan/ui" instead of "@vyductan/components"
fix(english-form): change form submission to use onSubmit handler instead of inline function to improve code readability
feat(english-form): add toast notification for error handling in case of API request failure
fix(english-form): change component name from HomePage to EnglishPage to improve semantics

* chore(dahsboard-header): organize imports and fix formatting inconsistencies

* chore: remove unused code and delete file

* chore(blogs): update import paths for Table component in Table.tsx
chore(blogs): update import paths for ColumnDef type in Table.tsx

* refactor(chat): update import statements for components in Chat, ChatMessage, ChatPanel, and PromptForm components

The import statements for components in the Chat, ChatMessage, ChatPanel, and PromptForm components have been updated to use the new component library "@vyductan/ui" instead of "@vyductan/components" and "@vyductan/utils". This change was made to align with the new component library and improve code organization and maintainability.

* chore(chat-ai): remove unused import of React in the features page component
chore(chat-ai): remove unused import of Link from @vyductan/react in the features page component
chore(chat-ai): remove unused import of FEATURES_ROUTES in the features page component

* chore:

* chore:

* feat(ProjectsPage): add CreateProjectForm component to allow users to create new projects
feat(ProjectsPage): add ProjectsTable component to display a table of projects

* fix(chat/route.ts): remove unused imports and commented out code
feat(chat/route.ts): add support for generating speech using OpenAI's text-to-speech API

* chore(stores): remove unused files and code related to Redux store and sagas

The following files and code have been removed:
- `hooks.ts`: Removed unused custom hooks for Redux store.
- `rootSlice.ts`: Removed unused Redux slice for managing the current paragraph state.
- `saga.tsx`: Removed unused Redux saga file.
- `settings.ts`: Removed unused Redux slice for managing the sidebar visibility state.
- `store.ts`: Removed unused Redux store configuration and wrapper.

These files and code were removed to clean up the project and remove unnecessary dependencies and unused code.

* fix(header): change Button type prop to variant prop to match the correct prop name
fix(header): change the callbackUrl query parameter from "referer" to "x-url" to match the correct header name
feat(middleware): add "x-url" header to the response to provide the current URL in the server-side middleware

* feat(english): remove unnecessary header and add WordTable component to the page for displaying and managing vocabulary

* feat(projects): create new component ProjectsForm to replace AddProjectForm and handle both create and update project functionality

* fix(CreateTaskForm.tsx): remove unused imports and variables
feat(TasksModalForm.tsx): create new component to replace CreateTaskForm.tsx and add support for editing tasks
fix(TasksTable.tsx): add action column with TasksModalForm component for editing tasks
fix(page.tsx): remove import of CreateTaskForm and replace with TasksModalForm for adding tasks, comment out TasksGantt component
fix(page.tsx): add TasksModalForm component for adding tasks and pass projectId prop to TasksTable component
feat(page.tsx): add ProjectsModalForm component for adding and editing projects, replace CreateProjectForm component
fix(page.tsx): add Dialog component for testing purposes

* feat(upload): add route for handling image uploads

This commit adds a new file `route.ts` in the `apps/nextjs/src/app/api/images/upload` directory. This file contains a function `POST` that handles image uploads.

The function uses the `handleUpload` function from the `@vercel/blob/client` package to handle the upload process. It expects a JSON body with the following properties: `body`, `request`, `onBeforeGenerateToken`, and `onUploadCompleted`.

The `onBeforeGenerateToken` function is responsible for generating a client token for the browser to upload the file. It ensures that only specific content types (`image/jpeg`, `image/png`, `image/gif`) are allowed and can include additional payload data.

The `onUploadCompleted` function is called when the client upload is completed. It receives the uploaded `blob` and the `tokenPayload`. In this implementation, it logs the uploaded blob and token payload. Additional logic can be added to handle the uploaded file, such as updating a user's avatar in a database.

If any errors occur during the upload process, a JSON response with an error message is returned with a status code of 400. The webhook will retry the request up to 5 times waiting for a 200 response.

* fix(PromptForm.tsx): change button type from "primary" to "variant" to match the component API
refactor(OpenAISTream.ts): remove unnecessary import of env.mjs and update import of types
refactor(OpenAISTream.ts): use nullish coalescing operator instead of logical OR operator for text variable assignment
refactor(OpenAISTream.ts): use nullish coalescing operator instead of logical OR operator for match result in if condition
refactor(route.ts): reorder imports and update import of types
refactor(route.ts): move OpenAIStream import below type imports for better organization

* chore(index): update

* feat(trpc): add support for tRPC React integration in Next.js app

This commit adds a new file `trpc/react.tsx` which contains the necessary code to integrate tRPC with React in a Next.js app. It exports a `TRPCReactProvider` component that wraps the app and provides the necessary context for tRPC calls. It also exports an `api` object that can be used to make tRPC calls from React components.

The `TRPCReactProvider` component uses `@tanstack/react-query` to manage the query client and `@trpc/react-query` to create the tRPC client. It also includes links for logging and batching/streaming requests.

The `getBaseUrl` function is used to determine the base URL for making tRPC requests. It checks if the code is running in the browser, in which case it uses the current origin, or if it's running in a server-side rendering context, in which case it uses the Vercel URL, or if none of those conditions are met, it uses `localhost` with the port specified by the `PORT` environment variable.

feat(trpc/server.ts_): add support for tRPC server integration in Next.js app

This commit adds a new file `trpc/server.ts_` which contains the necessary code to integrate tRPC with the server-side of a Next.js app. It exports an `api` object that can be used to handle tRPC calls.

The `createContext` function is used to create the tRPC context for handling tRPC calls from a React Server Component. It sets the session and headers based on the current request.

The `api` object is created using the `createCaller` function from `@vyductan/api` and the `createContext` function. It can be used to handle tRPC calls by passing the appropriate procedure and arguments.

* feat(nextjs): add global CSS file for importing theme styles
feat(nextjs): update layout component to use new global CSS file
feat(nextjs): add metadata and viewport configuration to layout component
feat(nextjs): add support for dynamic headers in AppProvider component
feat(nextjs): update AppProvider component to use TRPCReactProvider and ThemeToggle component

* chore(next.config.js): comment out unused rewrites to improve code readability and remove unnecessary code
chore(next.config.js): update optimizePackageImports to use the correct package name
chore(next.config.js): update images configuration to include remotePatterns for dynamic image domains
chore(next.config.js): remove transpilePackages for @vyductan/components and @vyductan/components-pro as they are not used
chore(package.json): update @hookform/resolvers to version 3.3.4 for bug fixes and improvements
chore(package.json): update @tanstack/react-query, @tanstack/react-query-devtools, and @tanstack/react-query-next-experimental to version 5.17.1 for bug fixes and improvements
chore(package.json): update @vyductan/ui to version 0.1.0 for new features and improvements
chore(package.json): update @vyductan/tts to workspace:* for local development
chore(package.json): update @vyductan/ui-pro to workspace:* for local development
chore(package.json): update ai to version 2.2.31 for bug fixes and improvements
chore(package.json): update clsx to version 2.1.0 for bug fixes and improvements
chore(package.json): update date-fns to version 3.1.0 for bug fixes and improvements
chore(package.json): update framer-motion to version 10.17.4 for bug fixes and improvements
chore(package.json): update geist to version 1.2.0 for bug fixes and improvements
chore(package.json): update sass to version 1.69.7 for bug fixes and improvements
chore(package.json): update @vyductan/eslint-config, @vyductan/theme-config, and @vyductan/typescript-config to workspace:* for local development
chore(package.json): update typescript to version 5.3.3 for bug fixes and improvements
chore(layout.tsx): change import statement for ReactNode to use type keyword for better code readability
chore(TasksModalForm.tsx): change import statement for Spin component from @vyductan/ui to improve code readability
chore(env.js): update comment to improve code readability
chore(tailwind.config.ts): append paths to @vyductan/ui, @vyductan/ui-pro, and @vyductan/tts to content array for correct

* chore: run prettier

* chore(nextjs): update dependencies in package.json

- Remove "@hookform/resolvers" dependency
- Update "@t3-oss/env-nextjs" to version "^0.7.3"
- Update "@tanstack/react-query" to version "^5.17.15"
- Update "@tanstack/react-query-devtools" to version "^5.17.15"
- Update "@tanstack/react-query-next-experimental" to version "5.17.15"
- Update "@vercel/blob" to version "^0.18.0"
- Update "date-fns" to version "^3.2.0"
- Update "framer-motion" to version "^10.18.0"
- Update "geist" to version "^1.2.1"
- Update "next-international" to version "^1.2.3"
- Update "openai" to version "^4.24.7"
- Update "react-hook-form" to version "^7.49.3"
- Remove "react-markdown" dependency
- Remove "react-syntax-highlighter" dependency
- Update "@types/eslint" to version "^8.56.2"
- Update "@types/node" to version "^20.11.4"
- Update "@types/react" to version "18.2.48"
- Update "@types/react-scroll" to version "^1.8.10"

These updates were made to keep the project up to date with the latest versions of the dependencies and to ensure compatibility and stability.

* feat(auth): add environment variable validation and configuration for Google OAuth client credentials

feat(auth): enable Google OAuth provider with configured client credentials

* chore(.gitmodules): remove unused submodule entry for src/@vyductan
chore(README.md): update latest commit link to Jan 7, 2024
chore(package.json): update devDependencies versions for @turbo/gen, node-gyp-build, prettier, and turbo
chore(package.json): update packageManager version to [email protected]
chore(package.json): update engines.node version to >=v20.10
chore(pnpm-workspace.yaml): add exclusion for @vyductan/.git directory in pnpm workspace

* chore: don't pass headers to cc

t3-oss/create-t3-app#1723

* chore: update @auth/core

* chore(projects-tasks): remove unused code

* feat(locale): add translation for "No Data" in Norwegian language
feat(locale): add translation for "Today" in English language

* chore: remove twin-marco

* chore:

* chore(types): remove unused type declarations

The following type declarations were removed:

- `google-translate-tts.d.ts`
- `merge-type.d.ts`
- `partial-null.d.ts`
- `svg.d.ts`
- `twin.d.ts`

These types were no longer being used in the project and were causing unnecessary clutter. Removing them improves code readability and maintainability.

* chore(utils): remove unused files

- api.ts

- serverAction.ts

- serverFn.ts

- trpc-provider.tsx

* chore: remove antd provider

* feat(upload): add upload function to handle file uploads

The `upload` function is added to handle file uploads. It takes in two parameters: `file` and `fileName`. It uses the `@vercel/blob/client` library to upload the file to a specified URL (`/api/images/upload`) with the specified access level (`public`). This function will be used to handle file uploads in the application.

* fix(english-router.ts): change publicProcedure.query to protectedProcedure.query for the 'all' endpoint to restrict access to authenticated users only
feat(english-router.ts): add support for updating word definitions by implementing the 'update' endpoint
feat(english-router.ts): add support for retrieving word definitions by ID by implementing the 'byId' endpoint
feat(english-router.ts): add support for deleting word definitions by implementing the 'delete' endpoint
fix(english-schema.ts): add 'id' column to the wordDefinitions table with nanoid as the default value and make it the primary key

* chore(env.js): add BLOB_READ_WRITE_TOKEN environment variable to server configuration
chore(env.js): add BLOB_READ_WRITE_TOKEN environment variable to runtime environment configuration
feat(index.ts): add createCaller function to create a server-side caller for the tRPC API
feat(root.ts): add imagesRouter to appRouter
chore(trpc.ts): add createCallerFactory function to create a server-side caller

* feat(db-custom-types.ts): add custom type TsRange and custom type tsrange to handle PostgreSQL tsrange data type

The custom type TsRange is added to handle a range of dates in the form of a start and end date. It provides getter methods for the start and end values of the range.

The custom type tsrange is added as a customType in drizzle-orm/pg-core to handle the PostgreSQL tsrange data type. It provides conversion methods from the driver value to the custom type TsRange and vice versa. The fromDriver method parses the string value from the driver and creates a new TsRange object. The toDriver method serializes the TsRange object to a string value that can be sent to the driver.

* chore(db-custom-types.ts): remove unused custom types file

The file `db-custom-types.ts` was removed as it contained unused custom types and was no longer needed in the project. This commit removes the file from the codebase.

* chore(README.md): update latest commit information and remove unnecessary date in the header
docs(README.md): update project description and mention the use of Next.js and create-next-app

* chore(ui_v1): remove lint and lint:fix scripts from package.json as they are no longer needed

* feat(test-editor): add test editor page component

This commit adds a new file `page.tsx` which contains the implementation of the test editor page component. The component imports the `Editor` component from the `@vyductan/ui/editor` package using dynamic import to ensure it is not included in server-side rendering. The component renders an instance of the `Editor` component with a predefined value object representing the initial content of the editor.

Additionally, the component defines an `apiUpload` function that is used for uploading files within the editor. The function makes use of the `upload` function from the `~/lib/upload` module to upload a file and returns an object with the uploaded file's information.

This new component is intended to be used in the dashboard section of the application for testing purposes.

* chore(theme-page): add key prop to the div elements in the palette map to fix React warning

* fix(expo): Revert node-linker=hoisted

* feat: update node to 20.11.0

* chore: bump trpc

* chore: bump next-auth

* chore: remove @auth/core

* .ts env files

* remove need for AUTH_URL

* chore(deps): update pnpm to v8.15.1

* chore(deps): update dependency prettier to ^3.2.5

* fixed jiti import for windows

* fixed jiti import for windows
* fixed using fileURLToPath
* fixed typo* made it a oneliner
* fixed formatting

* chore: add funding information for the project

chore: add issue templates for bug reports and feature requests

chore: add Renovate configuration file

chore: add CI workflow for linting, formatting, and typechecking

* chore(WordModalForm.tsx): replace Loader component with Spin component for consistency and better user experience
fix(WordTable.tsx): update render function to destructure record parameter for better readability and maintainability
feat(api-english): add "phrase" as a valid word class in the wordClassEnum

* ???
devvianto605 pushed a commit to devvianto605/create-devviantex-nextjs-app that referenced this pull request Jun 9, 2024
Co-authored-by: Christopher Ehrlich <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📌 area: cli Relates to the CLI 📌 area: t3-app Relates to the generated T3 App
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants