web: fix theme flashing
Created by: valerybugakov
Context
Because the global theme class was added in the useEffect
after the initial DOM tree render, it caused the CSS transition on some elements.
Changes
- Global theme class is now added via a synchronous function that's memoized to prevent redundant DOM updates.
- A small dependency (400b) was added to use a proper memoization function. See here why the lodash equivalent is not enough here. A proper memorization function would be useful in other places.
Closes https://github.com/sourcegraph/sourcegraph/issues/26435