Skip to content

Commit 68457a5

Browse files
committed
chore: Debug AetherPage SSR
1 parent 3a870b8 commit 68457a5

File tree

5 files changed

+57
-4
lines changed

5 files changed

+57
-4
lines changed

apps/next/next.config.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ const nextConfig = {
7070
images: {
7171
domains: ['i3.ytimg.com'],
7272
},
73-
webpack: (config, { isServer }) => {
73+
webpack: (config, { dev, isServer }) => {
7474
// -i- Run aetherspace automation scripts in DEV mode
7575
if (!isServer && process.env.NODE_ENV === 'development') withAutomation()
7676
// Enable top level await in API handlers
@@ -87,6 +87,23 @@ const nextConfig = {
8787
config.plugins.push(new FilterWarningsPlugin({
8888
exclude: [/the request of a dependency is an expression/],
8989
}))
90+
91+
// -i- Uncomment the following lines to debug with console logs during `next build` -i-
92+
93+
// if (!dev && !isServer) {
94+
// config.optimization.minimizer = config.optimization.minimizer.map(plugin => {
95+
// if (plugin.constructor.name === 'TerserPlugin') {
96+
// plugin.options.terserOptions = {
97+
// ...plugin.options.terserOptions,
98+
// // Prevent discarding or mangling of console statements
99+
// compress: { ...plugin.options.terserOptions.compress, drop_console: false },
100+
// mangle: { ...plugin.options.terserOptions.mangle, reserved: ['console'] },
101+
// }
102+
// }
103+
// return plugin;
104+
// })
105+
// }
106+
90107
// Return config
91108
return config
92109
},

packages/@aetherspace-clerk-auth/middleware/swrClerkAuthMiddleware.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Middleware } from 'swr'
22
import { getEnvList, getEnvVar, getGlobal, setGlobal } from 'aetherspace/utils'
3-
import { AetherFetcherOptions } from 'aetherspace/navigation'
3+
import type { AetherFetcherOptions } from 'aetherspace/navigation'
44
import axios from 'axios'
55

66
/** --- swrClerkAuthMiddleware() --------------------------------------------------------------- */

packages/@aetherspace/navigation/useRouteParams/useRouteParams.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { useSearchParams } from 'expo-router'
2-
// Types
32
import { RoutePropsType } from './useRouteParams.types'
43

54
/** --- useRouteParams() ----------------------------------------------------------------------- */

packages/@aetherspace/navigation/useRouteParams/useRouteParams.web.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { useSearchParams } from 'next/navigation'
2-
// Types
32
import { RoutePropsType } from './useRouteParams.types'
43

54
/** --- useRouteParams() ----------------------------------------------------------------------- */

patches/@clerk+nextjs+4.29.1.patch

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
diff --git a/node_modules/@clerk/nextjs/dist/cjs/app-router/client/ClerkProvider.js b/node_modules/@clerk/nextjs/dist/cjs/app-router/client/ClerkProvider.js
2+
index 4f25392..b77dacc 100644
3+
--- a/node_modules/@clerk/nextjs/dist/cjs/app-router/client/ClerkProvider.js
4+
+++ b/node_modules/@clerk/nextjs/dist/cjs/app-router/client/ClerkProvider.js
5+
@@ -38,11 +38,12 @@ var import_react = __toESM(require("react"));
6+
var import_NextOptionsContext = require("../../client-boundary/NextOptionsContext");
7+
var import_useSafeLayoutEffect = require("../../client-boundary/useSafeLayoutEffect");
8+
var import_mergeNextClerkPropsWithEnv = require("../../utils/mergeNextClerkPropsWithEnv");
9+
-var import_useAwaitableNavigate = require("./useAwaitableNavigate");
10+
+// var import_useAwaitableNavigate = require("./useAwaitableNavigate");
11+
const ClientClerkProvider = (props) => {
12+
const { __unstable_invokeMiddlewareOnAuthStateChange = true } = props;
13+
const router = (0, import_navigation.useRouter)();
14+
- const navigate = (0, import_useAwaitableNavigate.useAwaitableNavigate)();
15+
+ // const navigate = (0, import_useAwaitableNavigate.useAwaitableNavigate)();
16+
+ const navigate = router.push;
17+
(0, import_useSafeLayoutEffect.useSafeLayoutEffect)(() => {
18+
window.__unstable__onBeforeSetActive = () => {
19+
if (__unstable_invokeMiddlewareOnAuthStateChange) {
20+
diff --git a/node_modules/@clerk/nextjs/dist/esm/app-router/client/ClerkProvider.js b/node_modules/@clerk/nextjs/dist/esm/app-router/client/ClerkProvider.js
21+
index 79a81db..7a5ba43 100644
22+
--- a/node_modules/@clerk/nextjs/dist/esm/app-router/client/ClerkProvider.js
23+
+++ b/node_modules/@clerk/nextjs/dist/esm/app-router/client/ClerkProvider.js
24+
@@ -5,11 +5,12 @@ import React from "react";
25+
import { ClerkNextOptionsProvider } from "../../client-boundary/NextOptionsContext";
26+
import { useSafeLayoutEffect } from "../../client-boundary/useSafeLayoutEffect";
27+
import { mergeNextClerkPropsWithEnv } from "../../utils/mergeNextClerkPropsWithEnv";
28+
-import { useAwaitableNavigate } from "./useAwaitableNavigate";
29+
+// import { useAwaitableNavigate } from "./useAwaitableNavigate";
30+
const ClientClerkProvider = (props) => {
31+
const { __unstable_invokeMiddlewareOnAuthStateChange = true } = props;
32+
const router = useRouter();
33+
- const navigate = useAwaitableNavigate();
34+
+ // const navigate = useAwaitableNavigate();
35+
+ const navigate = router.push;
36+
useSafeLayoutEffect(() => {
37+
window.__unstable__onBeforeSetActive = () => {
38+
if (__unstable_invokeMiddlewareOnAuthStateChange) {

0 commit comments

Comments
 (0)