-
Notifications
You must be signed in to change notification settings - Fork 13k
chore: More steps towards isolating client code from Meteor APIs #36858
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 |
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #36858 +/- ##
========================================
Coverage 67.78% 67.78%
========================================
Files 3449 3449
Lines 113987 113985 -2
Branches 20956 20955 -1
========================================
+ Hits 77262 77264 +2
+ Misses 34610 34607 -3
+ Partials 2115 2114 -1
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
8026940 to
177ebc9
Compare
3f13333 to
bfde8e6
Compare
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.
Pull Request Overview
This PR advances the "demeteorization" initiative by isolating client code from Meteor APIs and reorganizing the codebase structure. The changes introduce non-reactive replacements for Meteor methods, relocate framework-specific code, and consolidate omnichannel functionality.
Key changes:
- Introduces
getUserId()as a non-reactive replacement forMeteor.userId() - Colocates Meteor-specific code under
client/meteor/directory structure - Merges
client/omnichannelandclient/views/omnichanneldirectories
Reviewed Changes
Copilot reviewed 207 out of 265 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/ui-contexts/src/hooks/useUserId.ts | Removes explicit return type annotation for useUserId hook |
| packages/ui-contexts/src/UserContext.ts | Changes userId type from string | null to string | undefined |
| packages/mock-providers/src/MockedAppRootBuilder.tsx | Updates mock values to use undefined instead of null for userId |
| apps/meteor/client/views/root/hooks/*.ts | Updates import paths to reflect reorganized directory structure |
| apps/meteor/client/views/omnichannel/**/*.tsx | Consolidates omnichannel code with updated import paths |
| apps/meteor/client/stores/*.ts | Refactors store imports to use new modular structure |
| apps/meteor/client/meteor/overrides/*.ts | Relocates Meteor API overrides to dedicated directory |
| apps/meteor/client/lib/user.ts | Introduces new user state management utilities |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| const ThreadTitle = ({ mainMessage }: ThreadTitleProps) => { | ||
| const innerHTML = useMemo(() => ({ __html: normalizeThreadTitle(mainMessage) ?? '' }), [mainMessage]); | ||
| const me = useUser()?.username || ''; | ||
| const pattern = useSetting('UTF8_User_Names_Validation', '[0-9a-zA-Z-_.]+'); | ||
| const useRealName = useSetting('UI_Use_Real_Name', false); | ||
|
|
||
| const html = useMemo((): string => { | ||
| const message = { ...mainMessage }; | ||
|
|
||
| if (message.msg) { | ||
| const filteredMessage = filterMarkdown(escapeHTML(message.msg)); | ||
| if (!message.channels && !message.mentions) { | ||
| return filteredMessage; | ||
| } | ||
|
|
||
| const instance = new MentionsParser({ | ||
| pattern: () => pattern, | ||
| useRealName: () => useRealName, | ||
| me: () => me, | ||
| userTemplate: ({ label }) => `<strong> ${label} </strong>`, | ||
| roomTemplate: ({ prefix, mention }) => `${prefix}<strong> ${mention} </strong>`, | ||
| }); | ||
| const html = emojiParser(filteredMessage); | ||
| return instance.parse({ ...message, msg: filteredMessage, html }).html ?? ''; | ||
| } | ||
|
|
||
| if (message.attachments) { | ||
| const attachment = message.attachments.find((attachment) => attachment.title || attachment.description); | ||
|
|
||
| if (attachment?.description) { | ||
| return escapeHTML(attachment.description); | ||
| } | ||
|
|
||
| if (attachment?.title) { | ||
| return escapeHTML(attachment.title); | ||
| } | ||
| } | ||
|
|
||
| return ''; | ||
| }, [mainMessage, me, pattern, useRealName]); | ||
|
|
||
| const innerHTML = useMemo(() => ({ __html: html }), [html]); | ||
| return <ContextualbarTitle dangerouslySetInnerHTML={innerHTML} />; | ||
| }; |
Copilot
AI
Sep 3, 2025
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.
[nitpick] The inlined thread title normalization logic creates code duplication and increases complexity. Consider extracting this logic into a reusable utility function or custom hook to improve maintainability and reduce the component's responsibility.
eb25f0c to
083aa7e
Compare
083aa7e to
5cbb683
Compare
5cbb683 to
6e8b70f
Compare
6e8b70f to
8ed0f58
Compare
8ed0f58 to
a4a2081
Compare
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
a4a2081 to
87e1674
Compare
87e1674 to
1c0778c
Compare
1c0778c to
4e4c4ce
Compare
Proposed changes (including videos or screenshots)
It performs a series of changes in client code codebase to isolate it from Meteor APIs.
client/meteor.getUserId()as a non-reactive replacement forMeteor.userId().client/meteor/startup.client/omnichannelandclient/views/omnichannel.Issue(s)
ARCH-1795
Steps to test or reproduce
Further comments
This PR is part of our “demeteorization” initiative.
Theoretically, the changes presented here aim to make the code to act like a facade for Meteor, isolating events and providing structures to be injected. For instance, it's delivered a Zustand store for the framework to inform the current user ID instead of watching changes on
Meteor.userId()to mutate the state ofUserProvideri.e. the code acts like a server for the framework rather than a dependent consumer built on top of it.