Skip to content
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

Merged
merged 2 commits into from
Nov 1, 2024
Merged

Conversation

skanderm
Copy link
Contributor

@skanderm skanderm temporarily deployed to orcasite-pr-675 October 10, 2024 23:00 Inactive
@@ -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];
Copy link
Contributor Author

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

Copy link
Member

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)

@paulcretu paulcretu temporarily deployed to orcasite-pr-675 October 16, 2024 16:18 Inactive
@dthaler
Copy link
Contributor

dthaler commented Oct 16, 2024

@coderabbitai review

Copy link

coderabbitai bot commented Oct 16, 2024

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@@ -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];
Copy link
Member

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)

@paulcretu paulcretu merged commit 8ef4852 into main Nov 1, 2024
10 checks passed
@paulcretu paulcretu deleted the skander/autoselect-feed branch November 1, 2024 22:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Grayed out play button is confusing to users
3 participants