-
Notifications
You must be signed in to change notification settings - Fork 13.1k
[NEW] Enterprise tags #18276
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
[NEW] Enterprise tags #18276
Conversation
fc5ba09 to
8abf038
Compare
client/components/basic/PlanTag.js
Outdated
|
|
||
| useMemo(() => { | ||
| const loadTags = async () => { | ||
| setPlans(await getTags()); |
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.
There's a catch here: setPlans can be accidentally called after the component was unmounted, i.e., PlanTag may be already unmounted after the getTags() returned promise was resolved. To avoid that we usually do some kind of semaphore to skip the setPlans calls after unmount, but I've made a custom hook for that:
import { useSafely } from '@rocket.chat/fuselage-hooks';
const [plans, setPlans] = useSafely(useState([]));So setPlans can be called anytime.
N.B.: Pay attention to possible memory leaks, tough. If the promise never resolves, setPlans will be referenced forever, and the whole component as well.
Co-authored-by: Tasso Evangelista <[email protected]>
Co-authored-by: Tasso Evangelista <[email protected]>
|
This pull request introduces 3 alerts when merging fb443fe into f2ef91d - view on LGTM.com new alerts:
|
This reverts commit 96c21d8.
From #18276 Co-authored-by: Tasso Evangelista <[email protected]> Co-authored-by: Guilherme Gazzo <[email protected]> Co-authored-by: Martin Schoeler <[email protected]>
Based on this branch https://github.com/RocketChat/Rocket.Chat/pull/18093/files