-
Notifications
You must be signed in to change notification settings - Fork 2
Remove add-to-calendar components and convert events list to SSG #56
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,11 @@ | ||
| import "@/styles/globals.css"; | ||
|
|
||
| import { ClerkProvider, useUser, useClerk } from "@clerk/nextjs"; | ||
| import { GoogleAnalytics } from "@next/third-parties/google"; | ||
| import type { AppProps } from "next/app"; | ||
| import { Router, useRouter } from "next/router"; | ||
| import posthog from "posthog-js"; | ||
| import { PostHogProvider } from "posthog-js/react"; | ||
| import { useEffect } from "react"; | ||
| import { useEffect, useRef } from "react"; | ||
|
|
||
| // Strip traceparent headers from all fetch requests to prevent CORS issues | ||
| if (typeof window !== "undefined") { | ||
|
|
@@ -77,27 +76,34 @@ const AuthCheck = ({ children }: { children: React.ReactNode }) => { | |
| }; | ||
|
|
||
| export default function App({ Component, pageProps }: AppProps) { | ||
| useEffect(() => { | ||
| posthog.init(process.env.NEXT_PUBLIC_POSTHOG_KEY as string, { | ||
| api_host: process.env.NEXT_PUBLIC_POSTHOG_HOST || "https://us.i.posthog.com", | ||
| person_profiles: "always" as const, | ||
| loaded: (posthog) => { | ||
| if (process.env.NODE_ENV === "development") posthog.debug(); | ||
| }, | ||
| }); | ||
| const posthogInitialized = useRef(false); | ||
|
|
||
| const handleRouteChange = () => posthog?.capture("$pageview"); | ||
| useEffect(() => { | ||
| if (posthogInitialized.current) return; | ||
|
|
||
| Router.events.on("routeChangeComplete", handleRouteChange); | ||
| const initPostHog = () => { | ||
| posthogInitialized.current = true; | ||
| posthog.init(process.env.NEXT_PUBLIC_POSTHOG_KEY as string, { | ||
| api_host: process.env.NEXT_PUBLIC_POSTHOG_HOST || "https://us.i.posthog.com", | ||
| person_profiles: "always" as const, | ||
| loaded: (posthog) => { | ||
| if (process.env.NODE_ENV === "development") posthog.debug(); | ||
| }, | ||
| }); | ||
|
|
||
| return () => { | ||
| Router.events.off("routeChangeComplete", handleRouteChange); | ||
| const handleRouteChange = () => posthog?.capture("$pageview"); | ||
| Router.events.on("routeChangeComplete", handleRouteChange); | ||
| }; | ||
|
|
||
| if ("requestIdleCallback" in window) { | ||
| requestIdleCallback(initPostHog, { timeout: 3000 }); | ||
| } else { | ||
| setTimeout(initPostHog, 2000); | ||
| } | ||
|
Comment on lines
+81
to
+102
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
# Inspect the PostHog effect structure.
ast-grep outline src/pages/_app.tsx --items all --type function
# Check whether Pages Router Strict Mode is explicitly configured.
rg -n -C 3 --glob 'next.config.*' '\breactStrictMode\b' .
# Verify that every route listener setup has a matching removal.
rg -n -C 5 --glob 'src/pages/_app.tsx' \
'requestIdleCallback|setTimeout|routeChangeComplete|Router\.events\.(on|off)' \
src/pages/_app.tsxRepository: zurich-js/zurichjs-website Length of output: 1128 🏁 Script executed: #!/bin/bash
set -euo pipefail
# Read the relevant effect and configuration context.
cat -n src/pages/_app.tsx | sed -n '1,125p'
cat -n next.config.mjs | sed -n '1,30p'
cat -n package.json | sed -n '1,100p'
# Run a read-only lifecycle model of the current effect.
python3 - <<'PY'
listeners = []
initialized = False
def init_posthog():
global initialized
initialized = True
listeners.append("handleRouteChange")
# React Strict Mode runs setup, cleanup, then setup. The current effect has
# no cleanup, so both scheduled callbacks remain pending.
init_posthog_callbacks = [init_posthog, init_posthog]
for callback in init_posthog_callbacks:
callback()
print({
"scheduled_callbacks": len(init_posthog_callbacks),
"route_listeners_after_callbacks": len(listeners),
"duplicate_pageviews_per_route": len(listeners) > 1,
})
PYRepository: zurich-js/zurichjs-website Length of output: 8386 Restore the effect cleanup.
🤖 Prompt for AI Agents |
||
| }, []); | ||
|
|
||
| return ( | ||
| <PostHogProvider client={posthog}> | ||
| <GoogleAnalytics gaId="G-GWWBJT7QS5" /> | ||
| <ClerkProvider> | ||
| <AuthCheck> | ||
| <Component {...pageProps} /> | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Constrain the global overrides to their intended major versions.
The lockfile resolves
undicito8.10.0,js-yamlto5.3.0, andnanoidto5.1.16. Use exact patched versions or major-bounded ranges, with dependency-specific selectors where versions must coexist. A frozen install succeeding only confirms the lockfile is internally consistent; it does not address the compatibility risk from these major-version upgrades.📍 Affects 2 files
pnpm-workspace.yaml#L17-L23(this comment)package.json#L40-L46🤖 Prompt for AI Agents