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
Graph QL POC #6024
Graph QL POC #6024
Conversation
@larkox - Is this ready to be reviewed? I'd just like to take a look at the query. |
@agnivade As POC, it is ready to review (the only "missing part" is the channel stats that were merged not long ago, but there won't be much difference). My next objective (still not started) is to make this code "production ready", so any feedback on the current state is welcomed. |
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.
Just a small thing that I spotted.
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.
Ignore my previous comments. Queries look good to me. 👍
app/actions/remote/entry/common.ts
Outdated
@@ -324,37 +326,12 @@ export const syncOtherServers = async (serverUrl: string) => { | |||
for (const server of servers) { | |||
if (server.url !== serverUrl && server.lastActiveAt > 0) { | |||
registerDeviceToken(server.url); | |||
syncAllChannelMembers(server.url); | |||
appEntry(server.url, server.lastActiveAt, false); |
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.
@enahum This is the design choice that probably I should revert. My idea here was to reuse all the logic behind the entry to sync the other servers, but I understand we already are going through the App entry when we switch, right?
So... we only need the channel members (no categories, no channels, no nothing) to calculate unreads and mentions. Am I right?
If so, I will revert this change and update the "syncAllChannelMembers" to use graphQL too.
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 we only need channel members and threads to show the mention badges. As we switch servers we go through the appEntry
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.
Wohoo!
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.
overall looks very good
if (prefData.preferences) { | ||
const crtToggled = await getHasCRTChanged(database, prefData.preferences); | ||
if (crtToggled) { | ||
const {error} = await truncateCrtRelatedTables(serverUrl); |
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.
FYI @koox00
app/constants/custom_status.ts
Outdated
export enum CustomStatusDuration { | ||
DONT_CLEAR = '', | ||
THIRTY_MINUTES = 'thirty_minutes', | ||
ONE_HOUR = 'one_hour', | ||
FOUR_HOURS = 'four_hours', | ||
TODAY = 'today', | ||
THIS_WEEK = 'this_week', | ||
DATE_AND_TIME = 'date_and_time', | ||
} |
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 is causing the tests to fail
@@ -40,7 +39,6 @@ export { | |||
Categories, | |||
Channel, | |||
Config, | |||
CustomStatusDuration, |
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.
tests failing
@@ -8,7 +8,7 @@ import {Text, TouchableOpacity, View} from 'react-native'; | |||
import CompassIcon from '@components/compass_icon'; | |||
import CustomStatusExpiry from '@components/custom_status/custom_status_expiry'; | |||
import FormattedText from '@components/formatted_text'; | |||
import {CustomStatusDuration, CST} from '@constants/custom_status'; | |||
import {CST} from '@constants/custom_status'; |
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.
test failing..
types/api/users.d.ts
Outdated
enum CustomStatusDuration { | ||
DONT_CLEAR = '', | ||
THIRTY_MINUTES = 'thirty_minutes', | ||
ONE_HOUR = 'one_hour', | ||
FOUR_HOURS = 'four_hours', | ||
TODAY = 'today', | ||
THIS_WEEK = 'this_week', | ||
DATE_AND_TIME = 'date_and_time', | ||
} |
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.
I think we'll need a const for this as the tests are failing
@avinashlng1080 please review |
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.
LGTM. Just left a few comments that if need be can be tackled in future PRs
if (duration && duration === CustomStatusDuration.DATE_AND_TIME) { | ||
if (duration && duration === 'date_and_time') { |
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.
Why not do duration === CustomStatusDurationEnum.DATE_AND_TIME
?
{emoji: 'house', message: t('custom_status.suggestions.working_from_home'), messageDefault: 'Working from home', durationDefault: CustomStatusDuration.TODAY}, | ||
{emoji: 'palm_tree', message: t('custom_status.suggestions.on_a_vacation'), messageDefault: 'On a vacation', durationDefault: CustomStatusDuration.THIS_WEEK}, | ||
{emoji: 'calendar', message: t('custom_status.suggestions.in_a_meeting'), messageDefault: 'In a meeting', durationDefault: 'one_hour'}, | ||
{emoji: 'hamburger', message: t('custom_status.suggestions.out_for_lunch'), messageDefault: 'Out for lunch', durationDefault: 'thirty_minutes'}, |
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 have done CustomStatusDurationEnum.THIRTY_MINUTES
?
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.
We could, but I feel this is more idiomatic on how TypeScript works. The only one we use the enum in many places is the one that translates to ''
, since it is not readable enough.
|
||
if (chData?.channels?.length && chData.memberships?.length) { | ||
// defer fetching posts for unread channels on initial team | ||
fetchPostsForUnreadChannels(serverUrl, chData.channels, chData.memberships, initialChannelId); |
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.
On the Gekidou branch, we had a fix from PR #6453 to delay the fetchPostsForUnreadChannels call. Though it was a fix, we should check if this is happening on the 'GraphQL' flow as well.
Summary
This is just a draft to show off the progress made. Most of what has been done is just exploratory. It still can use lots of refinement.
Ticket Link
None
Release Note