diff --git a/web/components/layout/tabs.tsx b/web/components/layout/tabs.tsx index 2b82ed34..6844fd99 100644 --- a/web/components/layout/tabs.tsx +++ b/web/components/layout/tabs.tsx @@ -32,6 +32,7 @@ type TabProps = { trackingName?: string // Default is to lazy render tabs as they are selected. If true, it will render all tabs at once. renderAllTabs?: boolean + name?: string // a unique identifier for the tabs, used for caching } export function MinimalistTabs(props: TabProps & { activeIndex: number }) { @@ -203,7 +204,7 @@ export function UncontrolledTabs(props: TabProps & { defaultIndex?: number }) { const { defaultIndex, onClick, ...rest } = props const [activeIndex, setActiveIndex] = usePersistentInMemoryState( defaultIndex ?? 0, - `tab-${props.trackingName}-${props.tabs[0]?.title}` + `tab-${props.trackingName}-${props.name ?? props.tabs[0]?.title}` ) if ((defaultIndex ?? 0) > props.tabs.length - 1) { console.error('default index greater than tabs length') diff --git a/web/pages/compatibility.tsx b/web/pages/compatibility.tsx index 19002575..6b098bd8 100644 --- a/web/pages/compatibility.tsx +++ b/web/pages/compatibility.tsx @@ -22,10 +22,8 @@ export default function CompatibilityPage() { const user = useUser() const isMobile = useIsMobile() const sep = isMobile ? '\n' : '' - const {compatibilityAnswers, refreshCompatibilityAnswers} = - useUserCompatibilityAnswers(user?.id) - const {compatibilityQuestions, refreshCompatibilityQuestions} = - useCompatibilityQuestionsWithAnswerCount() + const {compatibilityAnswers, refreshCompatibilityAnswers} = useUserCompatibilityAnswers(user?.id) + const {compatibilityQuestions, refreshCompatibilityQuestions} = useCompatibilityQuestionsWithAnswerCount() const [isLoading, setIsLoading] = useState(true) const questionsWithAnswers = useMemo(() => { @@ -77,62 +75,59 @@ export default function CompatibilityPage() { refreshCompatibilityQuestions() } - if (!user) { - return ( - + return ( + + {user ? + + Your Compatibility Questions + + ), + }, + { + title: `To Answer ${sep}(${notAnswered.length})`, + content: ( + + ), + }, + { + title: `Skipped ${sep}(${skipped.length})`, + content: ( + + ), + }, + ]} + /> + + :
Please sign in to view your compatibility questions
-
- ) - } - - return ( - - - Your Compatibility Questions - - ), - }, - { - title: `To Answer ${sep}(${notAnswered.length})`, - content: ( - - ), - }, - { - title: `Skipped ${sep}(${skipped.length})`, - content: ( - - ), - }, - ]} - /> - + } ) } diff --git a/web/pages/notifications.tsx b/web/pages/notifications.tsx index 9a8a9652..7eb0bf0a 100644 --- a/web/pages/notifications.tsx +++ b/web/pages/notifications.tsx @@ -22,6 +22,7 @@ export default function NotificationsPage() { Updates }, {title: 'Settings', content: }, diff --git a/web/pages/settings.tsx b/web/pages/settings.tsx index da928d3b..c62394d3 100644 --- a/web/pages/settings.tsx +++ b/web/pages/settings.tsx @@ -26,6 +26,7 @@ export default function NotificationsPage() { Settings }, {title: 'Notifications', content: },