Commit graph

11 commits

Author SHA1 Message Date
infinite-persistence cded632fd2
DateTime: avoid unnecessary update (#6110)
## Issue
Part of `5834 Performance investigation`

In a homepage with 120 tiles, the lists get rendered 3 times during initial update. The sub-components are updating recursively (will investigate), so instead of 120 DateTime renders, we have 1000+ renders.

The resolved DateTime string for `timeAgo` rarely changes, and even if the string was "a few seconds ago", there's no real need to constantly update it.

## Change
Require a minimum 1-minute delta when deciding whether the component should update. Clients can change this value as needed.

## Test
- [x] Verified `shouldComponentUpdate` doesn't end up taking more time than not having it (it's in micro-second range, compared to the millisecond render).
- [x] Profiler showed no significant improvement for low number of DateTime components, but for the 120 DateTime case, almost 1/4 of a second is saved.
2021-05-24 18:29:58 -04:00
Stefan Sundin 039264531f Add 24-hour clock setting. 2021-04-06 13:00:10 -04:00
Stefan Sundin 92e55c7d5f Add a title with the exact date to dateTime elements that use timeAgo. 2021-04-03 00:32:06 -04:00
Sean Yesmunt 61dfc2f74a handle comment time display correctly immediately after posting 2020-10-05 11:54:20 -04:00
Sean Yesmunt 951d7bbb63 remove 'show both' date option in DateTime 2020-07-09 14:49:36 -04:00
infiinte-persistence 598c336b66 Refactor DateTime to allow it's translated result string to be re-used elsewhere, for consistency. 2020-05-11 14:54:05 -04:00
infiinte-persistence 2582627f25 Fix localization issue in DateTime.
The class was only returning a localized string for 'years' and 'months'; English was used for the rest.

- Fixed by handling the remaining cases.
- New strings were added (1) so that they will all be consistent language-wise until the translators handle them all (2) allows for cleaner code through variable re-use (%duration%).
2020-05-11 14:54:05 -04:00
Sean Yesmunt 893e7fbb1b round dates down for months and days 2019-12-13 10:36:48 -05:00
Sean Yesmunt 208fe57ed7 fix date rounding 2019-12-13 10:36:48 -05:00
Sean Yesmunt c1131a374b hopefully stop app crashes because of bad dates
https://github.com/GoogleChrome/lighthouse/issues/1056
2019-12-05 01:09:08 -05:00
Sean Yesmunt 6ad31a3ce9 refactor lbrytv web server 2019-11-11 13:27:29 -05:00
Renamed from src/ui/component/dateTime/view.jsx (Browse further)