Skip to content

Commit

Permalink
chore: Debug AetherPage SSR
Browse files Browse the repository at this point in the history
  • Loading branch information
codinsonn committed Jan 11, 2024
1 parent 3a870b8 commit 68457a5
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 4 deletions.
19 changes: 18 additions & 1 deletion apps/next/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const nextConfig = {
images: {
domains: ['i3.ytimg.com'],
},
webpack: (config, { isServer }) => {
webpack: (config, { dev, isServer }) => {
// -i- Run aetherspace automation scripts in DEV mode
if (!isServer && process.env.NODE_ENV === 'development') withAutomation()
// Enable top level await in API handlers
Expand All @@ -87,6 +87,23 @@ const nextConfig = {
config.plugins.push(new FilterWarningsPlugin({
exclude: [/the request of a dependency is an expression/],
}))

// -i- Uncomment the following lines to debug with console logs during `next build` -i-

// if (!dev && !isServer) {
// config.optimization.minimizer = config.optimization.minimizer.map(plugin => {
// if (plugin.constructor.name === 'TerserPlugin') {
// plugin.options.terserOptions = {
// ...plugin.options.terserOptions,
// // Prevent discarding or mangling of console statements
// compress: { ...plugin.options.terserOptions.compress, drop_console: false },
// mangle: { ...plugin.options.terserOptions.mangle, reserved: ['console'] },
// }
// }
// return plugin;
// })
// }

// Return config
return config
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Middleware } from 'swr'
import { getEnvList, getEnvVar, getGlobal, setGlobal } from 'aetherspace/utils'
import { AetherFetcherOptions } from 'aetherspace/navigation'
import type { AetherFetcherOptions } from 'aetherspace/navigation'
import axios from 'axios'

/** --- swrClerkAuthMiddleware() --------------------------------------------------------------- */
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { useSearchParams } from 'expo-router'
// Types
import { RoutePropsType } from './useRouteParams.types'

/** --- useRouteParams() ----------------------------------------------------------------------- */
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { useSearchParams } from 'next/navigation'
// Types
import { RoutePropsType } from './useRouteParams.types'

/** --- useRouteParams() ----------------------------------------------------------------------- */
Expand Down
38 changes: 38 additions & 0 deletions patches/@clerk+nextjs+4.29.1.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
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
index 4f25392..b77dacc 100644
--- a/node_modules/@clerk/nextjs/dist/cjs/app-router/client/ClerkProvider.js
+++ b/node_modules/@clerk/nextjs/dist/cjs/app-router/client/ClerkProvider.js
@@ -38,11 +38,12 @@ var import_react = __toESM(require("react"));
var import_NextOptionsContext = require("../../client-boundary/NextOptionsContext");
var import_useSafeLayoutEffect = require("../../client-boundary/useSafeLayoutEffect");
var import_mergeNextClerkPropsWithEnv = require("../../utils/mergeNextClerkPropsWithEnv");
-var import_useAwaitableNavigate = require("./useAwaitableNavigate");
+// var import_useAwaitableNavigate = require("./useAwaitableNavigate");
const ClientClerkProvider = (props) => {
const { __unstable_invokeMiddlewareOnAuthStateChange = true } = props;
const router = (0, import_navigation.useRouter)();
- const navigate = (0, import_useAwaitableNavigate.useAwaitableNavigate)();
+ // const navigate = (0, import_useAwaitableNavigate.useAwaitableNavigate)();
+ const navigate = router.push;
(0, import_useSafeLayoutEffect.useSafeLayoutEffect)(() => {
window.__unstable__onBeforeSetActive = () => {
if (__unstable_invokeMiddlewareOnAuthStateChange) {
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
index 79a81db..7a5ba43 100644
--- a/node_modules/@clerk/nextjs/dist/esm/app-router/client/ClerkProvider.js
+++ b/node_modules/@clerk/nextjs/dist/esm/app-router/client/ClerkProvider.js
@@ -5,11 +5,12 @@ import React from "react";
import { ClerkNextOptionsProvider } from "../../client-boundary/NextOptionsContext";
import { useSafeLayoutEffect } from "../../client-boundary/useSafeLayoutEffect";
import { mergeNextClerkPropsWithEnv } from "../../utils/mergeNextClerkPropsWithEnv";
-import { useAwaitableNavigate } from "./useAwaitableNavigate";
+// import { useAwaitableNavigate } from "./useAwaitableNavigate";
const ClientClerkProvider = (props) => {
const { __unstable_invokeMiddlewareOnAuthStateChange = true } = props;
const router = useRouter();
- const navigate = useAwaitableNavigate();
+ // const navigate = useAwaitableNavigate();
+ const navigate = router.push;
useSafeLayoutEffect(() => {
window.__unstable__onBeforeSetActive = () => {
if (__unstable_invokeMiddlewareOnAuthStateChange) {

1 comment on commit 68457a5

@vercel
Copy link

@vercel vercel bot commented on 68457a5 Jan 11, 2024

Choose a reason for hiding this comment

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

Please sign in to comment.