Skip to content
Merged

Fix ssr #13561

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
1,358 changes: 1,335 additions & 23 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/create-audius-app/examples/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"build": "npx tsc && vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview",
"start": "npm run preview"
Expand Down
2 changes: 1 addition & 1 deletion packages/distro/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"start:dev": "env-cmd -f .env.dev turbo run start --filter=@audius/distro",
"start:stage": "env-cmd -f .env.stage turbo run start --filter=@audius/distro",
"start:prod": "env-cmd -f .env.prod turbo run start --filter=@audius/distro",
"build": "tsc && vite build",
"build": "npx tsc && vite build",
"build:dev": "env-cmd -f .env.dev turbo run build --filter=@audius/distro",
"build:stage": "env-cmd -f .env.stage turbo run build --filter=@audius/distro",
"build:prod": "env-cmd -f .env.prod turbo run build --filter=@audius/distro",
Expand Down
4 changes: 2 additions & 2 deletions packages/eth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"module": "dist/esm/index.js",
"types": "dist/types/index.d.ts",
"scripts": {
"start": "tsc --build --verbose --watch tsconfig.all.json",
"build": "tsc --build --verbose tsconfig.all.json",
"start": "npx tsc --build --verbose --watch tsconfig.all.json",
"build": "npx tsc --build --verbose tsconfig.all.json",
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
Expand Down
6 changes: 3 additions & 3 deletions packages/fixed-decimal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
"types": "./dist/types/index.d.ts"
},
"scripts": {
"start": "./scripts/makePackageTypes.sh && tsc --build --verbose --watch tsconfig.build.json",
"build": "./scripts/makePackageTypes.sh && tsc --build --verbose tsconfig.build.json",
"typecheck": "tsc --noEmit",
"start": "./scripts/makePackageTypes.sh && npx tsc --build --verbose --watch tsconfig.build.json",
"build": "./scripts/makePackageTypes.sh && npx tsc --build --verbose tsconfig.build.json",
"typecheck": "npx tsc --noEmit",
"test": "vitest run",
"test:watch": "vitest"
},
Expand Down
6 changes: 3 additions & 3 deletions packages/identity-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
"lint:fix": "eslint --fix --ext=js,ts src",
"lint": "eslint --ext=js,ts src",
"copyfiles": "cp -r ./src/notifications/emails ./build/src/notifications",
"build": "tsc --project tsconfig.build.json && npm run copyfiles",
"typecheck": "tsc",
"typecheck:watch": "tsc --watch",
"build": "npx tsc --project tsconfig.build.json && npm run copyfiles",
"typecheck": "npx tsc",
"typecheck:watch": "npx tsc --watch",
"verify": "concurrently \"npm:typecheck\" \"npm:lint\""
},
"dependencies": {
Expand Down
4 changes: 2 additions & 2 deletions packages/mobile/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1369,7 +1369,7 @@ PODS:
- React
- react-native-google-cast/NoBluetoothArm (= 4.6.2)
- react-native-google-cast/NoBluetoothArm (4.6.2):
- google-cast-sdk-dynamic-xcframework-no-bluetooth
- google-cast-sdk-dynamic-xcframework-no-bluetooth (= 4.7.1)
- React
- react-native-google-cast/RNGoogleCast
- react-native-google-cast/RNGoogleCast (4.6.2):
Expand Down Expand Up @@ -2872,7 +2872,7 @@ SPEC CHECKSUMS:
react-native-document-picker: 9fe3cd3187a2995d78d1f34d3a52eac1b68df245
react-native-fast-crypto: b30594570dab23aca7e74e206b2c03e28a006216
react-native-get-random-values: 384787fd76976f5aec9465aff6fa9e9129af1e74
react-native-google-cast: 18b9b2fc518caabfa65d309409e160b3fc6d1733
react-native-google-cast: 0a82cf63114470403e41e04ffa2b13d6448b6112
react-native-image-picker: 42e3b160d82fb168288345db3b9a2a99aad02afe
react-native-in-app-review: db8bb167a5f238e7ceca5c242d6b36ce8c4404a4
react-native-keyboard-controller: 3aaba4f7015628ca833ce7ad889754571cef6455
Expand Down
4 changes: 2 additions & 2 deletions packages/spl/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"module": "dist/esm/index.js",
"types": "dist/types/index.d.ts",
"scripts": {
"start": "tsc --build --verbose --watch tsconfig.all.json",
"build": "tsc --build --verbose tsconfig.all.json",
"start": "npx tsc --build --verbose --watch tsconfig.all.json",
"build": "npx tsc --build --verbose tsconfig.all.json",
"test": "vitest run",
"test:watch": "vitest"
},
Expand Down
4 changes: 3 additions & 1 deletion packages/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@
"type-fest": "4.26.1",
"typed-redux-saga": "1.3.1",
"typesafe-actions": "5.1.0",
"unenv": "2.0.0-rc.24",
"viem": "2.21.21",
"vike": "0.4.247",
"vike-react": "^0.3.7",
Expand Down Expand Up @@ -266,6 +267,7 @@
"vite-plugin-glslify": "2.0.2",
"vite-plugin-node-polyfills": "^0.15.0",
"vite-plugin-svgr": "4.1.0",
"vitest": "^3.2.4"
"vitest": "^3.2.4",
"wrangler": "4.54.0"
}
}
9 changes: 1 addition & 8 deletions packages/web/src/ssr/+onRenderClient.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Buffer } from 'buffer'
import './polyfills'

import 'setimmediate'
import processBrowser from 'process/browser'
import { hydrateRoot } from 'react-dom/client'
import type { PageContextClient } from 'vike/types'

Expand All @@ -10,12 +9,6 @@ import { isMobile as getIsMobile } from 'utils/clientUtil'
import '../index.css'
import { checkIsCrawler } from './util'

// @ts-ignore
window.global ||= window
// @ts-ignore
window.Buffer = Buffer
window.process = { ...processBrowser, env: process.env }

// Set this to false to turn off client hydration
// Useful for testing the SSR output
const HYDRATE_CLIENT = true
Expand Down
11 changes: 2 additions & 9 deletions packages/web/src/ssr/audio/+onRenderClient.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,15 @@
// Simple SSR pages use createRoot instead of hydrateRoot
// to avoid hydration mismatches since we only render meta tags during SSR

import 'setimmediate'
import { Buffer } from 'buffer'
import '../polyfills'

import processBrowser from 'process/browser'
import 'setimmediate'
import { createRoot } from 'react-dom/client'

import '../../index.css'
import RootWithProviders from 'ssr/RootWithProviders'
import { isMobile as getIsMobile } from 'utils/clientUtil'

// @ts-ignore
window.global ||= window
// @ts-ignore
window.Buffer = Buffer
window.process = { ...processBrowser, env: process.env }

export default function render() {
const container = document.getElementById('root')
if (container) {
Expand Down
11 changes: 2 additions & 9 deletions packages/web/src/ssr/cash/+onRenderClient.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,15 @@
// Simple SSR pages use createRoot instead of hydrateRoot
// to avoid hydration mismatches since we only render meta tags during SSR

import 'setimmediate'
import { Buffer } from 'buffer'
import '../polyfills'

import processBrowser from 'process/browser'
import 'setimmediate'
import { createRoot } from 'react-dom/client'

import '../../index.css'
import RootWithProviders from 'ssr/RootWithProviders'
import { isMobile as getIsMobile } from 'utils/clientUtil'

// @ts-ignore
window.global ||= window
// @ts-ignore
window.Buffer = Buffer
window.process = { ...processBrowser, env: process.env }

export default function render() {
const container = document.getElementById('root')
if (container) {
Expand Down
11 changes: 2 additions & 9 deletions packages/web/src/ssr/coins/+onRenderClient.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,15 @@
// Simple SSR pages use createRoot instead of hydrateRoot
// to avoid hydration mismatches since we only render meta tags during SSR

import 'setimmediate'
import { Buffer } from 'buffer'
import '../polyfills'

import processBrowser from 'process/browser'
import 'setimmediate'
import { createRoot } from 'react-dom/client'

import '../../index.css'
import RootWithProviders from 'ssr/RootWithProviders'
import { isMobile as getIsMobile } from 'utils/clientUtil'

// @ts-ignore
window.global ||= window
// @ts-ignore
window.Buffer = Buffer
window.process = { ...processBrowser, env: process.env }

export default function render() {
const container = document.getElementById('root')
if (container) {
Expand Down
11 changes: 2 additions & 9 deletions packages/web/src/ssr/dashboard/+onRenderClient.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,15 @@
// Simple SSR pages use createRoot instead of hydrateRoot
// to avoid hydration mismatches since we only render meta tags during SSR

import 'setimmediate'
import { Buffer } from 'buffer'
import '../polyfills'

import processBrowser from 'process/browser'
import 'setimmediate'
import { createRoot } from 'react-dom/client'

import '../../index.css'
import RootWithProviders from 'ssr/RootWithProviders'
import { isMobile as getIsMobile } from 'utils/clientUtil'

// @ts-ignore
window.global ||= window
// @ts-ignore
window.Buffer = Buffer
window.process = { ...processBrowser, env: process.env }

export default function render() {
const container = document.getElementById('root')
if (container) {
Expand Down
11 changes: 2 additions & 9 deletions packages/web/src/ssr/download/+onRenderClient.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,15 @@
// Simple SSR pages use createRoot instead of hydrateRoot
// to avoid hydration mismatches since we only render meta tags during SSR

import 'setimmediate'
import { Buffer } from 'buffer'
import '../polyfills'

import processBrowser from 'process/browser'
import 'setimmediate'
import { createRoot } from 'react-dom/client'

import '../../index.css'
import RootWithProviders from 'ssr/RootWithProviders'
import { isMobile as getIsMobile } from 'utils/clientUtil'

// @ts-ignore
window.global ||= window
// @ts-ignore
window.Buffer = Buffer
window.process = { ...processBrowser, env: process.env }

export default function render() {
const container = document.getElementById('root')
if (container) {
Expand Down
11 changes: 2 additions & 9 deletions packages/web/src/ssr/explore/+onRenderClient.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,15 @@
// Simple SSR pages use createRoot instead of hydrateRoot
// to avoid hydration mismatches since we only render meta tags during SSR

import 'setimmediate'
import { Buffer } from 'buffer'
import '../polyfills'

import processBrowser from 'process/browser'
import 'setimmediate'
import { createRoot } from 'react-dom/client'

import '../../index.css'
import RootWithProviders from 'ssr/RootWithProviders'
import { isMobile as getIsMobile } from 'utils/clientUtil'

// @ts-ignore
window.global ||= window
// @ts-ignore
window.Buffer = Buffer
window.process = { ...processBrowser, env: process.env }

export default function render() {
const container = document.getElementById('root')
if (container) {
Expand Down
11 changes: 2 additions & 9 deletions packages/web/src/ssr/feed/+onRenderClient.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,15 @@
// Simple SSR pages use createRoot instead of hydrateRoot
// to avoid hydration mismatches since we only render meta tags during SSR

import 'setimmediate'
import { Buffer } from 'buffer'
import '../polyfills'

import processBrowser from 'process/browser'
import 'setimmediate'
import { createRoot } from 'react-dom/client'

import '../../index.css'
import RootWithProviders from 'ssr/RootWithProviders'
import { isMobile as getIsMobile } from 'utils/clientUtil'

// @ts-ignore
window.global ||= window
// @ts-ignore
window.Buffer = Buffer
window.process = { ...processBrowser, env: process.env }

export default function render() {
const container = document.getElementById('root')
if (container) {
Expand Down
11 changes: 2 additions & 9 deletions packages/web/src/ssr/history/+onRenderClient.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,15 @@
// Simple SSR pages use createRoot instead of hydrateRoot
// to avoid hydration mismatches since we only render meta tags during SSR

import 'setimmediate'
import { Buffer } from 'buffer'
import '../polyfills'

import processBrowser from 'process/browser'
import 'setimmediate'
import { createRoot } from 'react-dom/client'

import '../../index.css'
import RootWithProviders from 'ssr/RootWithProviders'
import { isMobile as getIsMobile } from 'utils/clientUtil'

// @ts-ignore
window.global ||= window
// @ts-ignore
window.Buffer = Buffer
window.process = { ...processBrowser, env: process.env }

export default function render() {
const container = document.getElementById('root')
if (container) {
Expand Down
11 changes: 2 additions & 9 deletions packages/web/src/ssr/index/+onRenderClient.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,14 @@
// simply render the SPA without SSR
// TODO: Use vike SPA setting

import 'setimmediate'
import { Buffer } from 'buffer'
import '../polyfills'

import processBrowser from 'process/browser'
import 'setimmediate'
import { createRoot } from 'react-dom/client'

import '../../index.css'
import RootWithProviders from 'ssr/RootWithProviders'

// @ts-ignore
window.global ||= window
// @ts-ignore
window.Buffer = Buffer
window.process = { ...processBrowser, env: process.env }

export default function render() {
const container = document.getElementById('root')
if (container) {
Expand Down
11 changes: 2 additions & 9 deletions packages/web/src/ssr/library/+onRenderClient.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,15 @@
// Simple SSR pages use createRoot instead of hydrateRoot
// to avoid hydration mismatches since we only render meta tags during SSR

import 'setimmediate'
import { Buffer } from 'buffer'
import '../polyfills'

import processBrowser from 'process/browser'
import 'setimmediate'
import { createRoot } from 'react-dom/client'

import '../../index.css'
import RootWithProviders from 'ssr/RootWithProviders'
import { isMobile as getIsMobile } from 'utils/clientUtil'

// @ts-ignore
window.global ||= window
// @ts-ignore
window.Buffer = Buffer
window.process = { ...processBrowser, env: process.env }

export default function render() {
const container = document.getElementById('root')
if (container) {
Expand Down
11 changes: 2 additions & 9 deletions packages/web/src/ssr/messages/+onRenderClient.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,15 @@
// Simple SSR pages use createRoot instead of hydrateRoot
// to avoid hydration mismatches since we only render meta tags during SSR

import 'setimmediate'
import { Buffer } from 'buffer'
import '../polyfills'

import processBrowser from 'process/browser'
import 'setimmediate'
import { createRoot } from 'react-dom/client'

import '../../index.css'
import RootWithProviders from 'ssr/RootWithProviders'
import { isMobile as getIsMobile } from 'utils/clientUtil'

// @ts-ignore
window.global ||= window
// @ts-ignore
window.Buffer = Buffer
window.process = { ...processBrowser, env: process.env }

export default function render() {
const container = document.getElementById('root')
if (container) {
Expand Down
Loading