Page MenuHomePhabricator

[web] Render calendar navigation tab conditionally
ClosedPublic

Authored by jacek on Feb 24 2022, 1:14 AM.
Tags
None
Referenced Files
F3488298: D3284.diff
Wed, Dec 18, 9:36 AM
Unknown Object (File)
Nov 15 2024, 8:59 AM
Unknown Object (File)
Nov 5 2024, 9:44 PM
Unknown Object (File)
Oct 20 2024, 8:28 PM
Unknown Object (File)
Oct 16 2024, 4:26 PM
Unknown Object (File)
Oct 14 2024, 2:43 AM
Unknown Object (File)
Oct 14 2024, 2:43 AM
Unknown Object (File)
Oct 14 2024, 2:42 AM

Details

Summary

Render calendar tab only if it is enabled - like in mobile app. By default it is enabled and the setting is not persisted after page refresh yet.

Test Plan

After introducing apps page (next diff), run web app and switch the calendar in Apps page. The navigation link to calendar should appear only if calendar enabled.

Diff Detail

Repository
rCOMM Comm
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

tomek requested changes to this revision.Feb 24 2022, 3:28 AM
tomek added inline comments.
web/sidebar/app-switcher.react.js
116 ↗(On Diff #9879)

Is classNames function memoized? If it isn't, then calendarNavClasses value will be different in every render and this whole memoization is completely useless.

To fix the issue we should either remove React.useMemo and not memoize this component or move calendarNavClasses inside the memo. It looks like the component is really simple so memoizing it is not necessary, but it's up to you.

This revision now requires changes to proceed.Feb 24 2022, 3:28 AM

Moved calendarNavClasses into useMemo to avoid redundant rerenders

tomek added inline comments.
web/sidebar/app-switcher.react.js
102–107 ↗(On Diff #9891)

We don't need to define calendarNavClasses when isCalendarEnabled is false.

This revision is now accepted and ready to land.Feb 24 2022, 4:01 AM
This revision now requires review to proceed.Feb 24 2022, 4:01 AM
This revision is now accepted and ready to land.Feb 24 2022, 9:40 AM