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

channels: make sure channel data is up to date when we have unreads #3267

Merged
merged 2 commits into from
Feb 21, 2024

Conversation

patosullivan
Copy link
Member

Fixes LAND-1556.

getQueryData was always returning undefined in my testing locally, so rather than only refetching if we have cached data for a query, we just fetch the query if we have an unread for the channel (since we know we will use that data later).

I also noticed that channelKey in state/channel/keys.ts was using 'channel' rather than 'channels'. 'channel' isn't used as a queryKey anywhere afaict, I assumed this was supposed to be 'channels', so I changed that.

Tested locally with livenet moons.

PR Checklist

  • Includes changes to desk files
  • Describes how you tested the PR locally (test ship vs livenet)
  • If a new feature, includes automated tests
  • Comments added anywhere logic may be confusing without context

Fixes LAND-1556.

getQueryData was always returning undefined in my testing locally, so rather than only refetching if we have cached data for a query, we just fetch the query if we have an unread for the channel (since we know we *will* use that data later).

I also noticed that channelKey in state/channel/keys.ts was using 'channel' rather than 'channels'. 'channel' isn't used as a queryKey anywhere afaict, I assumed this was supposed to be 'channels', so I changed that.
Copy link

linear bot commented Feb 21, 2024

@patosullivan patosullivan changed the title chat: make sure channel data is up to date when we have unreads channels: make sure channel data is up to date when we have unreads Feb 21, 2024
@patosullivan
Copy link
Member Author

Just realized this won't work for dms/clubs too. Will reopen when it does.

@patosullivan patosullivan marked this pull request as draft February 21, 2024 13:10
Similar changes to commit 91e281d, but for dms/clubs.
@patosullivan patosullivan marked this pull request as ready for review February 21, 2024 15:06
@patosullivan
Copy link
Member Author

Ok, now works for dms/clubs too.

Copy link
Member

@latter-bolden latter-bolden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code makes sense and looks good.

I am seeing getQueryData fire correctly for cached channels with unreads, not sure where the mixup is there. The only reason we didn't go this route originally was performance concerns with fetching all unread channels every time you open the app.

That said, I do think this approach is cleaner and should help with the referenced Linear issue. We should just make sure to monitor UX after it's merged, particularly with power users who may have lots of groups they don't always check.

@patosullivan patosullivan merged commit ffa2d95 into develop Feb 21, 2024
1 check passed
@patosullivan patosullivan deleted the po/land-1556-stale-channel-data branch February 21, 2024 19:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants