Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX theming bugs #5787

Merged
merged 13 commits into from
Mar 2, 2019
Merged

FIX theming bugs #5787

merged 13 commits into from
Mar 2, 2019

Conversation

ndelangen
Copy link
Member

Issue: #5746

What I did

  • FIX the theme not showing on first load
  • persist the theme into localstorage to prevent flash upon reload

I fixed this a bit quick and dirty, Will cleanup after V5 release

@vercel
Copy link

vercel bot commented Feb 27, 2019

This pull request is automatically deployed with Now.
To access deployments, click Details below or on the icon next to each push.

Copy link
Member

@tmeasday tmeasday left a comment

Choose a reason for hiding this comment

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

LGTM. Agreed that further refactoring into core/ui etc probably makes sense

# Conflicts:
#	examples/official-storybook/tests/__snapshots__/storyshots.test.js.snap
@vercel vercel bot requested a deployment to staging February 28, 2019 12:52 Abandoned
…e theme was getting lost

ADD telejson as stringifier & parser for persistence
CLEANUP state initialization
CHANGE initial state for shortcuts so it's not dependent on this.getState()
DEDUPLICATE merge util function
FIX unnecessary messages about transition & brand missing in theme
@codecov
Copy link

codecov bot commented Feb 28, 2019

Codecov Report

Merging #5787 into next will decrease coverage by 0.02%.
The diff coverage is 23.8%.

Impacted file tree graph

@@           Coverage Diff            @@
##           next    #5787      +/-   ##
========================================
- Coverage    34%   33.97%   -0.03%     
========================================
  Files       651      651              
  Lines      9473     9465       -8     
  Branches   1345     1368      +23     
========================================
- Hits       3221     3216       -5     
+ Misses     5637     5635       -2     
+ Partials    615      614       -1
Impacted Files Coverage Δ
lib/ui/src/core/initial-state.js 100% <ø> (ø) ⬆️
lib/ui/src/core/init-provider-api.js 0% <ø> (-25.81%) ⬇️
lib/ui/src/core/stories.js 87.23% <ø> (+0.44%) ⬆️
lib/ui/src/core/context.js 9.09% <0%> (ø) ⬆️
lib/ui/src/core/addons.js 0% <0%> (ø) ⬆️
lib/channel-postmessage/src/index.ts 0% <0%> (ø) ⬆️
lib/ui/src/components/layout/container.js 20.37% <0%> (ø) ⬆️
lib/theming/src/ensure.ts 0% <0%> (ø) ⬆️
lib/ui/src/core/store.js 100% <100%> (ø) ⬆️
lib/ui/src/core/layout.js 16.66% <25%> (+16.66%) ⬆️
... and 1 more

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 5d60575...6489d05. Read the comment docs.

@vercel vercel bot temporarily deployed to staging February 28, 2019 21:56 Inactive
@vercel vercel bot requested a deployment to staging February 28, 2019 22:17 Abandoned
@ndelangen
Copy link
Member Author

@tmeasday Ended up having to introduce telejson in the persistence anyway, and had to up the maxDepth a bit for postMessage (not the entire theme was getting through)

Copy link
Member

@tmeasday tmeasday left a comment

Choose a reason for hiding this comment

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

We decided not to persistence this way.. open to changing it in the future but not at this stage of the release.

lib/ui/src/core/context.js Show resolved Hide resolved
lib/ui/src/core/store.js Outdated Show resolved Hide resolved
@tmeasday
Copy link
Member

tmeasday commented Mar 1, 2019

Ok with the rest of it, but if the issue was combining the theme defaults with the persisted theme, that should just be done the same way that e.g. versions does it.

@vercel vercel bot requested a deployment to staging March 1, 2019 14:59 Abandoned
@vercel vercel bot requested a deployment to staging March 1, 2019 15:21 Abandoned
REMOVE merge from initial state
MOVE initial state of layout & ui to layout module
ADD merge of initial, restored to layout module
@vercel vercel bot requested a deployment to staging March 1, 2019 15:22 Abandoned
@ndelangen
Copy link
Member Author

@tmeasday thanks for the comments, You're right, I changed it back.

@vercel vercel bot requested a deployment to staging March 1, 2019 16:10 Abandoned
@vercel vercel bot requested a deployment to staging March 1, 2019 16:14 Abandoned
Copy link
Member

@tmeasday tmeasday left a comment

Choose a reason for hiding this comment

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

I think this is OK but i have a couple of comments that we should probably discuss and resolve in future versions

selectedPanel: ensurePanel(
api.getPanels(),
store.getState().selectedPanel,
store.getState().selectedPanel
Copy link
Member

Choose a reason for hiding this comment

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

This is a bit weerd (grabbing the selected panel twice). Is it intentional?

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, what's going on here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Just followed the arguments of ensurePanel,
I can remove 1 I think.

selectedPanel: options.panel || options.selectedPanel || selectedPanel,
},
{ persistence: 'permanent' }
);
Copy link
Member

Choose a reason for hiding this comment

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

Does this mean we perma-persist all options, including the ones that were session-persisted above?

I'm OK with this for now for simplicity, but we might want to do something more subtle in the future (which will probably require improvements to the persistence API)

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah I briefly experimented with persisting all the layout & ui options, but decided to not increase the size of this PR even more.

But it was actually really nice, things like full-screen, nav, panelPosition being preserved over refreshes...

On my todo list after V5 launch.

lib/ui/src/core/shortcuts.js Outdated Show resolved Hide resolved
@tmeasday
Copy link
Member

tmeasday commented Mar 2, 2019

Thanks for pulling the layout module out @ndelangen !

@ndelangen ndelangen merged commit b9cce09 into next Mar 2, 2019
@ndelangen ndelangen deleted the fix/theming-flash branch March 2, 2019 18:13
@shilman shilman added the patch:done Patch/release PRs already cherry-picked to main/release branch label Mar 3, 2019
shilman pushed a commit that referenced this pull request Mar 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug patch:done Patch/release PRs already cherry-picked to main/release branch theming
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants