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
rework tabs query state to work better across both routers #23253
Conversation
No changes detected in Branching Preview Branches by Supabase. |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
3 Ignored Deployments
|
059c2ae
to
c5cd516
Compare
c5cd516
to
a7e3c2c
Compare
a7e3c2c
to
8df3b7c
Compare
@@ -70,61 +67,31 @@ const Tabs: React.FC<PropsWithChildren<TabsProps>> & TabsSubComponents = ({ | |||
children?.[0]?.props?.id | |||
) | |||
|
|||
useEffect(() => { |
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.
Could we maybe just make a UI pattern component instead?
Currently trying to move away from using this component to the /shadcn/ui/tabs one, but even so, the logic of queryGroup
could be kept in some sort of wrapper component around that Tabs component, so the other Tabs are not burdened with it.
Wdyt?
Could have a quick huddle to spitball some ideas on that, not really thought it through.
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.
yeah good point, this is trying to do much for a basic tab
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.
alright, I've pulled it out as a HOC. Decided on a HOC because I have another PR that adds another functionality to tabs (stickiness) and I want to be able to compose the two, but open to other suggestions
f160ece
to
7e5a179
Compare
7e5a179
to
20d170d
Compare
@@ -2,7 +2,7 @@ import type { ModalProps } from '@ui/components/Modal/Modal' | |||
import { snakeCase } from 'lodash' | |||
import Link from 'next/link' | |||
import { useState } from 'react' | |||
import { Button, CodeBlock, IconExternalLink, Modal, Tabs, TabsProvider } from 'ui' |
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.
TabsProvider was only necessary to save selection state if there were multiple sets of tabs within the context, and has been superseded by the withQueryParams
HOC. This doesn't have multiple sets of tabs, so doesn't need either.
I have read the CONTRIBUTING.md file.
YES
What kind of change does this PR introduce?
Refactor + enhancement
What is the current behavior?
Tabs uses a messy combination of next/router and custom events to handle syncing state with other tabs + table of contents.
What is the new behavior?
Refactor tabs so that:
ui-patterns
, to keep the basic Tabs minimalMinor enhancement to save tab preferences to local storage so they are remembered between sessions
Additional context
Add any other context or screenshots.