Page MenuHomePhabricator

[web] Set document title in App component
ClosedPublic

Authored by tomek on Mar 4 2022, 8:07 AM.
Tags
None
Referenced Files
Unknown Object (File)
Nov 8 2024, 12:41 PM
Unknown Object (File)
Nov 2 2024, 12:01 AM
Unknown Object (File)
Oct 27 2024, 8:44 AM
Unknown Object (File)
Oct 14 2024, 3:06 AM
Unknown Object (File)
Oct 14 2024, 3:06 AM
Unknown Object (File)
Oct 14 2024, 3:06 AM
Unknown Object (File)
Oct 14 2024, 3:06 AM
Unknown Object (File)
Oct 14 2024, 2:59 AM

Details

Summary

In https://www.figma.com/file/a1nkbWgbgjRlrOY9LVurTz/Comm-%2F-Desktop-app?node-id=1272%3A88750 we're introducing a new navigation menu which will be rendered conditionally instead of AppSwitcher. Setting document title should always happen and that requires moving this functionality back (D2881) to the App.

Test Plan

Mark a thread as unread and check if the number in title was increased. Mark as unread and check if it decreased.

Diff Detail

Repository
rCOMM Comm
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

tomek requested review of this revision.Mar 4 2022, 8:12 AM
benschac added inline comments.
web/app.react.js
220

Might be for a different diff, but do you think this would be good as a hook? I can imagine there are going to be more use cases other than unread that we would want to update the title for in the future.

This revision is now accepted and ready to land.Mar 7 2022, 6:35 AM
web/app.react.js
220

We would want to make sure that we only have one effect that sets document.title, so I can't imagine this is something that would be reusable. Exporting it to a separate file as a named hook could be good for encapsulation, but right now it's so simple that I don't think it matters. Extra indirection generally come with a readability cost

web/app.react.js
220

It might be a good idea to extract it somewhere in the future, when the title becomes more complicated and would require more data, but currently keeping it here is good enough.

This revision was automatically updated to reflect the committed changes.