Skip to content

Conversation

seveibar
Copy link
Contributor

@seveibar seveibar commented Oct 4, 2025

Summary

  • update the header settings link to go to the signed-in user's settings page
  • add a dedicated redirect route so /settings forwards to /{username}/settings

Testing

  • bunx tsc --noEmit

https://chatgpt.com/codex/tasks/task_b_68e07e7cfd34832ebeb8ffe2c2546a0d

Comment on lines +1 to +44
import { useEffect, useState } from "react"
import { Redirect } from "wouter"

import { FullPageLoader } from "@/App"
import { useGlobalStore } from "@/hooks/use-global-store"

const SettingsRedirectPage = () => {
const session = useGlobalStore((state) => state.session)
const [hasHydrated, setHasHydrated] = useState(() => {
if (typeof window === "undefined") return false
return useGlobalStore.persist?.hasHydrated?.() ?? false
})

useEffect(() => {
if (typeof window === "undefined") return

if (useGlobalStore.persist?.hasHydrated?.()) {
setHasHydrated(true)
return
}

const unsubFinishHydration = useGlobalStore.persist?.onFinishHydration?.(
() => {
setHasHydrated(true)
},
)

return () => {
unsubFinishHydration?.()
}
}, [])

if (!hasHydrated) {
return <FullPageLoader />
}

if (!session?.github_username) {
return <Redirect to="/" />
}

return <Redirect to={`/${session.github_username}/settings`} />
}

export default SettingsRedirectPage
Copy link
Contributor

Choose a reason for hiding this comment

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

File naming inconsistency: The file settings-redirect.tsx uses kebab-case but does not match the exported component name SettingsRedirectPage. Fix by either:

  1. Renaming the file to SettingsRedirectPage.tsx to match the export name, or
  2. Renaming the export to SettingsRedirect to align with the kebab-case file name

Consistent naming conventions improve code maintainability and follow established project patterns.

Suggested change
import { useEffect, useState } from "react"
import { Redirect } from "wouter"
import { FullPageLoader } from "@/App"
import { useGlobalStore } from "@/hooks/use-global-store"
const SettingsRedirectPage = () => {
const session = useGlobalStore((state) => state.session)
const [hasHydrated, setHasHydrated] = useState(() => {
if (typeof window === "undefined") return false
return useGlobalStore.persist?.hasHydrated?.() ?? false
})
useEffect(() => {
if (typeof window === "undefined") return
if (useGlobalStore.persist?.hasHydrated?.()) {
setHasHydrated(true)
return
}
const unsubFinishHydration = useGlobalStore.persist?.onFinishHydration?.(
() => {
setHasHydrated(true)
},
)
return () => {
unsubFinishHydration?.()
}
}, [])
if (!hasHydrated) {
return <FullPageLoader />
}
if (!session?.github_username) {
return <Redirect to="/" />
}
return <Redirect to={`/${session.github_username}/settings`} />
}
export default SettingsRedirectPage
import { useEffect, useState } from "react"
import { Redirect } from "wouter"
import { FullPageLoader } from "@/App"
import { useGlobalStore } from "@/hooks/use-global-store"
const SettingsRedirect = () => {
const session = useGlobalStore((state) => state.session)
const [hasHydrated, setHasHydrated] = useState(() => {
if (typeof window === "undefined") return false
return useGlobalStore.persist?.hasHydrated?.() ?? false
})
useEffect(() => {
if (typeof window === "undefined") return
if (useGlobalStore.persist?.hasHydrated?.()) {
setHasHydrated(true)
return
}
const unsubFinishHydration = useGlobalStore.persist?.onFinishHydration?.(
() => {
setHasHydrated(true)
},
)
return () => {
unsubFinishHydration?.()
}
}, [])
if (!hasHydrated) {
return <FullPageLoader />
}
if (!session?.github_username) {
return <Redirect to="/" />
}
return <Redirect to={`/${session.github_username}/settings`} />
}
export default SettingsRedirect

Spotted by Diamond (based on custom rule: Custom rule)

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

@seveibar seveibar merged commit 8799826 into main Oct 4, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant