mirror of
https://github.com/supabase/supabase.git
synced 2026-12-05 16:09:06 +00:00
## Context Resolves FE-5165 The CLI login screen could get stuck on the loading state and never navigate to the device code view. Was happening due to two guards that interact badly: - `startedForSessionIdRef` stops the effect from sending a second POST for the same `session_id`. - An `isActive` flag, set to `false` in the effect cleanup, made the POST handler ignore its result once the effect had been cleaned up. It's seemingly a race condition issue as in my case I only ran into this problem locally, but not on staging as `isActive` was getting flipped to `false` and hence the UI never navigates to show the device code Opting to remove the `isActive` guard and solely rely on `startedForSessionIdRef.current` since the latter should be able to handle this logic by itself ## To test This one can only be tested locally i reckon - [ ] Verify that you can login via CLI via `supabase login --profile supabase-local`
Writing components
Where to create your components
- For components that declare the general structure and layout of a page:
/components/layouts/xxx
- For components that are tightly coupled to a specific interface:
/components/interfaces/xxx
- For components that are meant to be reusable across multiple pages:
/components/ui/xxx
- Note: We're gradually moving files out of the
to-be-cleanedfolder into the respective folders as we refactor
Component structure
- If a component has constants and utility methods that are tightly coupled to itself, keep them close to the component and enclose them in a folder with an
index.tsxas an entry point - Otherwise it can just be a file on its own
- For example:
-
components/ui - SampleComponentA - SampleComponentA.tsx - SampleComponentA.constants.ts - SampleComponentA.utils.ts - SampleComponentA.types.ts - index.ts - SampleComponentB.tsx
-
Template for building components
// Declare the prop types of your component
interface ComponentAProps {
sampleProp: string
}
// Name your component accordingly — use a named export, not a default export
export const ComponentA = ({ sampleProp }: ComponentAProps) => {
return <div>ComponentA: {sampleProp}</div>
}