Skip to content
This repository was archived by the owner on Mar 4, 2020. It is now read-only.

feat(Provider): add overwrite prop#1780

Merged
layershifter merged 6 commits intomasterfrom
feat/provider-overwrite
Aug 12, 2019
Merged

feat(Provider): add overwrite prop#1780
layershifter merged 6 commits intomasterfrom
feat/provider-overwrite

Conversation

@layershifter
Copy link
Member

@layershifter layershifter commented Aug 9, 2019

♻️ overwrite prop

This PR adds overwrite prop for Provider component. It allows to reset current context and avoid merging with existing themes. Existing behavior is preserved.

overwrite=false

<Provider theme={themes.teams}> // Teams theme
  <Provider theme={themes.base} /> // Teams + Base theme

overwrite=true

<Provider theme={themes.teams}> // Teams theme
  <Provider overwrite theme={themes.base} /> // Base theme

{...{ rehydrate: false }}
>
<ThemeProvider theme={outgoingContext}>
<ThemeProvider theme={outgoingContext} overwrite>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ThemeProvider comes from Fela, we should always use overwrite as Fela has own shallow merging.

https://github.com/robinweser/fela/blob/v10.6.1/packages/fela-bindings/src/ThemeProviderFactory.js

@lucivpav
Copy link
Contributor

lucivpav commented Aug 9, 2019

Let's test this change.

@codecov
Copy link

codecov bot commented Aug 9, 2019

Codecov Report

Merging #1780 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1780      +/-   ##
==========================================
+ Coverage   69.76%   69.77%   +<.01%     
==========================================
  Files         867      867              
  Lines        7353     7354       +1     
  Branches     2158     2136      -22     
==========================================
+ Hits         5130     5131       +1     
  Misses       2215     2215              
  Partials        8        8
Impacted Files Coverage Δ
...ackages/react/src/components/Provider/Provider.tsx 95.45% <100%> (+0.1%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 94feb58...878eef4. Read the comment docs.

@layershifter layershifter merged commit 39967a9 into master Aug 12, 2019
@delete-merged-branch delete-merged-branch bot deleted the feat/provider-overwrite branch August 12, 2019 12:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants