This repository was archived by the owner on Mar 4, 2020. It is now read-only.
[IMPORTANT] fix(rtl): disable RendererProvider rehydration#58
Merged
levithomason merged 1 commit intomasterfrom Aug 8, 2018
Merged
[IMPORTANT] fix(rtl): disable RendererProvider rehydration#58levithomason merged 1 commit intomasterfrom
levithomason merged 1 commit intomasterfrom
Conversation
Codecov Report
@@ Coverage Diff @@
## master #58 +/- ##
=====================================
Coverage 87% 87%
=====================================
Files 75 75
Lines 1177 1177
Branches 223 214 -9
=====================================
Hits 1024 1024
Misses 147 147
Partials 6 6
Continue to review full report at Codecov.
|
7d436eb to
aaa9c37
Compare
Contributor
|
We've discussed this issue with @miroslavstastny and agree on the following things
As a solution to this problem we could consider the following (mutually exclusive) options
<Provider renderer={ltrRenderer}> { /* fine as renderer wasn't defined so far */ }
<Provider renderer={rtlRenderer} ... > { /* no override happens, LTR renderer is still used for child tree */ }
...
</Provider>
</Provider>
|
levithomason
reviewed
Aug 8, 2018
| // https://github.com/rofrischmann/fela/blob/master/docs/api/fela-dom/rehydrate.md | ||
| return ( | ||
| <RendererProvider renderer={renderer}> | ||
| <RendererProvider renderer={renderer} {...{ rehydrate: false }}> |
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Provider
Disable rehydration in Fela
Providerto fix switching of FelaRenderers from LTR to RTL and back and using the two simultaneously.Details
In general it seems that Fela does not support using multiple
Renderers simultaneously on one page.By default when
Provideris created, it rehydrates = reads styles from DOM and places them in it's cache (ProviderFactory.js:24) asrehydrateis true by default (Provider.js:16).The DOM path it rehydrates from is hardcoded and not configurable (rehydrate.js:13) so there is no way how the two renderers could use different DOM element for the styles.
What happens is that when in docsite you switch one example to RTL, RTL styles are added to Fela - RTL instance of the renderer is used,
rtl_prefix is added to class names to avoid collisions and styles are rendered to DOM.But after that whenever a new
Provideris created, it rehydrates and adds RTL styles to it's cache.This is not a problem of the styles being different as the CSS rule is used as a key in the cache. But what happens is that classes are now added in different order to the elements resulting in different results.
Conclusion
TODO