-
Notifications
You must be signed in to change notification settings - Fork 11.7k
refactor: remove startup from Meteor #35915
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
base: develop
Are you sure you want to change the base?
Conversation
Looks like this PR is not ready to merge, because of the following issues:
Please fix the issues and try again If you have any trouble, please check the PR guidelines |
|
Code Review Completed! 🔥The code review was successfully completed based on your current configurations. Kody Guide: Usage and ConfigurationInteracting with Kody
Current Kody ConfigurationReview OptionsThe following review options are enabled or disabled:
|
return; | ||
} | ||
|
||
const getUser = async () => { |
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.
const getUser = async () => {
try {
const utcOffset = moment().utcOffset() / 60;
const user = await synchronizeUserData(uid);
if (!user) {
console.error('User data synchronization failed.'); // Or handle more gracefully
return;
}
if (user.utcOffset !== utcOffset) {
await sdk.call('userSetUtcOffset', utcOffset);
}
if (getUserPreference(user, 'enableAutoAway')) {
const idleTimeLimit = (getUserPreference(user, 'idleTimeLimit') as number | null | undefined) || 300;
UserPresence.awayTime = idleTimeLimit * 1000;
} else {
delete UserPresence.awayTime;
UserPresence.stopTimer();
}
setStatus(user.status);
UserPresence.start();
} catch (error) {
console.error('Error during user startup sequence:', error);
// Potentially set an error state or notify the user
}
};
The useStartup
hook lacks proper documentation, making it difficult to understand its purpose and usage.
This issue appears in multiple locations:
- apps/meteor/client/hooks/useStartup.ts: Lines 32-52
- apps/meteor/client/hooks/useStartup.ts: Lines 14-14
- apps/meteor/client/views/root/AppLayout.tsx: Lines 27-27
Please add JSDoc comments to theuseStartup
hook to clearly explain its functionality and any side effects.
Talk to Kody by mentioning @kody
Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.
import { synchronizeUserData, removeLocalUserData } from '../lib/userData'; | ||
import { fireGlobalEvent } from '../lib/utils/fireGlobalEvent'; | ||
|
||
export const useStartup = () => { |
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.
/**
* @description Hook to handle user-specific initialization after login.
* Synchronizes user data, sets UTC offset, configures presence (auto-away),
* updates status, starts presence tracking, and fires 'startup' and 'status-changed' global events.
*/
export const useStartup = () => {
The useStartup
hook lacks proper documentation, making it difficult to understand its purpose and usage.
This issue appears in multiple locations:
- apps/meteor/client/hooks/useStartup.ts: Lines 14-14
Please add JSDoc comments to theuseStartup
hook to clearly explain its functionality and any side effects.
Talk to Kody by mentioning @kody
Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #35915 +/- ##
========================================
Coverage 61.15% 61.15%
========================================
Files 3014 3014
Lines 71560 71560
Branches 16390 16390
========================================
Hits 43762 43762
Misses 24830 24830
Partials 2968 2968
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
|
ARCH-1551
Proposed changes (including videos or screenshots)
WIP
Issue(s)
Steps to test or reproduce
Further comments
This pull request refactors the Rocket.Chat codebase by removing the startup logic from Meteor and introducing a new React hook named
useStartup
. TheuseStartup
hook is responsible for handling user-specific initialization tasks after login, such as synchronizing user data, setting the UTC offset, configuring user presence based on preferences (including auto-away settings), and managing initial status updates through global events. Additionally, theuseStartup
hook has been integrated into theAppLayout
component. The changes are made in theapps/meteor/client/hooks/useStartup.ts
andapps/meteor/client/views/root/AppLayout.tsx
files. The source branch for this refactor isrefactor/startup
, and the target branch isdevelop
.