With a switch to Only One Webpack™ we need a way to help developers generate the component index without a concurrent watch task. The best way to do this is to have developers import their components, but how do they do that when we support skins? The answer in this commit is to change skinning.
Skinning now expects to receive your list of overrides instead of the react-sdk+branded components. For Riot this means we send over *only* the Vector components and not Vector+react-sdk.
Components can then be annotated with the `replaceComponent` decorator to have them be skinnable. The decorator must take a string with the dot path of the component because we can't reliably calculate it ourselves, sadly.
The decorator does a call to `getComponent` which is where the important part of the branded components not including the react-sdk is important: if the branded app includes the react-sdk then the decorator gets executed before the skin has finished loading, leading to all kinds of fun errors. This is also why the skinner lazily loads the react-sdk components to avoid importing them too early, breaking the app.
The decorator will end up receiving null for a component because of the getComponent loop mentioned: the require() call is still in progress when the decorator is called, therefore we can't error out. All usages of getComponent() within the app are safe to not need such an error (the return won't be null, and developers shouldn't use getComponent() after this commit anyways).
The AuthPage, being a prominent component, has been converted to demonstrate this working. Changes to riot-web are required to have this work.
The reskindex script has also been altered to reflect these skinning changes - it no longer should set the react-sdk as a parent. The eventual end goal is to get rid of `getComponent()` entirely as it'll be easily replaced by imports.
Correctly encode the `body` to avoid problems down the line. We also convert newlines to `<br/>` to better represent the message as a fallback.
Fixes https://github.com/vector-im/riot-web/issues/9413
See https://github.com/sinonjs/lolex/issues/136
We don't use fake timers, but we do use lolex's clock, which probably causes the same thing. Jumping from 2.x to 4.x looks largely compatible - tests pass.
Yarn deps can be a bit fiddly when targeting specific versions. This tweaks the
lock file to only pull in a single React version.
For others who may need to do something like this again, I recommend deleting
specific package entries from `yarn.lock` and re-running `yarn install`. That
should make it pick the right thing while also leaving other packages as they
were.
We may have used it in our jenkins tests at some point but we don't
have those anymore. It weas pulling in ancient dependencies because
we were using version 2.0.0 which is fact much older than the
current version (1.2.0). We have little use for junit output anymore
so just remove it.
Not added to the CI / default linting phases yet as, predictably
enough, it's very unhappy with our CSS. Just added one rule which is
that our CSS is indented with 4 spaces (the default being 2).
If we have account data in local storage but nothing in the crypto store, it
generally means the browser has evicted IndexedDB out from under us. This adds a
modal to explain the situation and offer to completely clear storage to get
things back to normal.
Fixes https://github.com/vector-im/riot-web/issues/9109
We moved off to our own fork of velocity many moons ago to fix
a memory leak bug when velocity was being barely maintained. They
have now merged the bugfix, so go back to mainline.
For the React SDK, we did not commit npm lock files, so there is no correct copy
to import from. For this repo, I created a fresh yarn lock file using yarn
install.