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

Upgrade Next.js & enable Turbopack #281

Merged
merged 4 commits into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"private": true,
"scripts": {
"build": "next build --debug",
"dev": "NODE_DEBUG=latitude:debug next dev",
"dev": "NODE_DEBUG=latitude:debug next dev --turbo",
"dev:debug": "NODE_DEBUG=latitude:debug NODE_OPTIONS='--inspect=0.0.0.0:9229' ./node_modules/.bin/next dev",
"dev:local": "USE_LOCALHOST=true pnpm run dev",
"lint": "next lint",
Expand Down Expand Up @@ -38,13 +38,14 @@
"lucia": "^3.2.0",
"monaco-editor": "^0.50.0",
"nanoid": "^5.0.7",
"next": "^14.3.0-canary.87",
"next": "15.0.0-canary.168",
"next-themes": "^0.3.0",
"nextjs-toploader": "^1.6.12",
"nprogress": "^0.2.0",
"oslo": "1.2.0",
Copy link
Contributor

Choose a reason for hiding this comment

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

was this a missing dependency?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah Turbopack actively shows that the dependency is missing when it's external, it would fail at runtime currently without this being installed directly.

"posthog-js": "^1.161.6",
"react": "19.0.0-rc-f994737d14-20240522",
"react-dom": "19.0.0-rc-f994737d14-20240522",
"react": "19.0.0-rc-5d19e1c8-20240923",
"react-dom": "19.0.0-rc-5d19e1c8-20240923",
"socket.io-react-hook": "^2.4.5",
"swr": "^2.2.5",
"use-debounce": "^10.0.1",
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/actions/user/logoutAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { authProcedure } from '$/actions/procedures'
import { removeSession } from '$/services/auth/removeSession'
import { ROUTES } from '$/services/routes'
import { ReadonlyRequestCookies } from 'next/dist/server/web/spec-extension/adapters/request-cookies'
import { cookies as getCookies } from 'next/headers'
import { redirect } from 'next/navigation'

function removeSocketCookie({
Expand All @@ -21,7 +22,6 @@ export const logoutAction = authProcedure
.createServerAction()
.handler(async ({ ctx }) => {
removeSession({ session: ctx.session })
const { cookies: getCookies } = await import('next/headers')

const cookies = getCookies()
removeSocketCookie({ name: 'websocket', cookies })
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/actions/user/refreshWebsocketTokenAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

import { verifyWebsocketToken } from '@latitude-data/core/websockets/utils'
import { setWebsocketSessionCookie } from '$/services/auth/setSession'
import { cookies } from 'next/headers'

import { authProcedure } from '../procedures'

export const refreshWebesocketTokenAction = authProcedure
.createServerAction()
.handler(async ({ ctx: { user, workspace } }) => {
const { cookies } = await import('next/headers')
const refreshWebsocketCookie = cookies().get('websocketRefresh')
const refreshToken = refreshWebsocketCookie?.value
const result = await verifyWebsocketToken({
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/services/auth/getSession.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { Session, User } from 'lucia'
import { cookies } from 'next/headers'

import { lucia } from '.'

Expand All @@ -7,7 +8,6 @@ export async function getSession(): Promise<
> {
// NOTE: We dynamically import the cookies function to make Nextjs happy
// Info: https://github.com/vercel/next.js/issues/49757
const { cookies } = await import('next/headers')
const sessionId = cookies().get(lucia.sessionCookieName)?.value ?? null
if (!sessionId) {
return {
Expand Down
4 changes: 1 addition & 3 deletions apps/web/src/services/auth/removeSession.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import { Session } from 'lucia'
import { cookies } from 'next/headers'

import { lucia } from '.'

export async function removeSession({ session }: { session: Session }) {
// NOTE: We dynamically import the cookies function to make Nextjs happy
// Info: https://github.com/vercel/next.js/issues/49757
const { cookies } = await import('next/headers')
await lucia.invalidateSession(session.id)
const sessionCookie = lucia.createBlankSessionCookie()
cookies().set(
Expand Down
2 changes: 1 addition & 1 deletion packages/web-ui/tailwind.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/** @type {import('tailwindcss').Config} */
module.exports = {
export default {
darkMode: ['class'],
content: ['./src/**/*.{ts,tsx}'],
theme: {
Expand Down
Loading
Loading