-
Notifications
You must be signed in to change notification settings - Fork 52
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
Select first online feed on layout load #675
Conversation
skanderm
commented
Oct 10, 2024
- Fixes Grayed out play button is confusing to users #334
@@ -44,6 +44,7 @@ function MapLayout({ children }: { children: ReactNode }) { | |||
const [currentFeed, setCurrentFeed] = useState(feed); | |||
const [map, setMap] = useState<LeafletMap>(); | |||
const feeds = useFeedsQuery().data?.feeds ?? []; | |||
const firstOnlineFeed = feeds.filter(({ online }) => online)[0]; |
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.
This should be fine for SSR since the query gets refetched by default (refetchOnMount is default true): https://tanstack.com/query/latest/docs/framework/react/reference/useQuery#usequery
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 should be fine for SSR although it will thrash a bit (first load with no feed selected, then once this requests runs, the page will switch over to the online feed)
@coderabbitai review |
✅ Actions performedReview triggered.
|
@@ -44,6 +44,7 @@ function MapLayout({ children }: { children: ReactNode }) { | |||
const [currentFeed, setCurrentFeed] = useState(feed); | |||
const [map, setMap] = useState<LeafletMap>(); | |||
const feeds = useFeedsQuery().data?.feeds ?? []; | |||
const firstOnlineFeed = feeds.filter(({ online }) => online)[0]; |
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 should be fine for SSR although it will thrash a bit (first load with no feed selected, then once this requests runs, the page will switch over to the online feed)