-
-
Notifications
You must be signed in to change notification settings - Fork 828
Conversation
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 seems fine, just a few comments relating to code style and a behavioural thing.
There's also a few mixed cases of {words}
and { words }
, which I believe is a lint rule applied after this PR was introduced: would be good to normalize before landing.
@@ -1,5 +1,5 @@ | |||
/* | |||
Copyright 2017 Travis Ralston | |||
Copyright 2021 The Matrix.org Foundation C.I.C. |
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.
goodbye, self.
(I'm okay with this happening - I don't want any of the old CSS associated with my name)
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 mean, there is no old CSS here. All of it is brand new, I probably renamed the file to save me having to copy-paste the license :)
const pinningEnabled = useSettingValue("feature_pinning"); | ||
const pinnedEvents = usePinnedEvents(pinningEnabled && room); | ||
const readPinnedEvents = useReadPinnedEvents(pinningEnabled && room); | ||
if (!pinningEnabled) return null; |
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 can probably short circuit this by not reading pinned events if the setting isn't enabled. ie: move new lines 47 and 48 to below this condition:
const pinningEnabled = useSettingValue("feature_pinning"); | |
const pinnedEvents = usePinnedEvents(pinningEnabled && room); | |
const readPinnedEvents = useReadPinnedEvents(pinningEnabled && room); | |
if (!pinningEnabled) return null; | |
const pinningEnabled = useSettingValue("feature_pinning"); | |
if (!pinningEnabled) return null; | |
const pinnedEvents = usePinnedEvents(pinningEnabled && room); | |
const readPinnedEvents = useReadPinnedEvents(pinningEnabled && room); |
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.
Hooks cannot be conditional.
But the two hooks here are effectively no-opd if you pass them a falsey as we are here.
The alternative would be tracking feature_pinning in RoomHeaderButtons but that's more lines of code due to the class setup than a useSettingValue
hook call
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.
well that's not very fun :(
This is fine, then.
Co-authored-by: Travis Ralston <travisr@matrix.org>
…-sdk into t3chguy/fix/6606
… t3chguy/fix/6606 � Conflicts: � src/components/structures/RoomView.tsx � src/components/views/right_panel/UserInfo.tsx
Fixes element-hq/element-web#5405
Fixes element-hq/element-web#5958
Fixes element-hq/element-web#5871
Fixes element-hq/element-web#17213
Fixes element-hq/element-web#6926
Screen.Recording.2021-05-26.at.15.20.12.mov
Skipping design/product as it isn't leaving Labs yet