Skip to content

save compact mode on localstorage#1918

Merged
juliusknorr merged 1 commit intomasterfrom
fix/compactModeOnLocalstorage
May 20, 2020
Merged

save compact mode on localstorage#1918
juliusknorr merged 1 commit intomasterfrom
fix/compactModeOnLocalstorage

Conversation

@jakobroehrl
Copy link
Copy Markdown
Contributor

Signed-off-by: Jakob Röhrl jakob.roehrl@web.de

@jakobroehrl jakobroehrl added this to the 1.0.2 milestone May 18, 2020
@jakobroehrl jakobroehrl self-assigned this May 18, 2020
@jakobroehrl jakobroehrl force-pushed the fix/compactModeOnLocalstorage branch from 65437db to 5a7d988 Compare May 18, 2020 08:27
@jakobroehrl jakobroehrl requested a review from juliusknorr May 18, 2020 08:28
Comment thread src/components/Controls.vue Outdated
Comment thread src/components/Controls.vue Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please move the localStorage handling to the store where toggleCompactMode is actually taking place.

The getItem can then also be fetched as initial value for the store data.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

How to add an created function in the main.js store to fetch the store data?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You can't and don't need one. You can just set it in the initial state of the store.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

How to do this? This is not working (main.js)
state: {
showArchived: false,
navShown: true,
compactMode: localStorage.getItem('deck.compactMode'),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You don't set it in your current pull request, once it is set that works like a charm here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Changed it, it's not working for me.
On every page reload it's compact

@jakobroehrl jakobroehrl force-pushed the fix/compactModeOnLocalstorage branch from 5a7d988 to f6ab10f Compare May 19, 2020 06:16
@jakobroehrl jakobroehrl requested a review from juliusknorr May 19, 2020 06:16
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

Merging #1918 into master will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master    #1918   +/-   ##
=======================================
  Coverage   56.92%   56.92%           
=======================================
  Files          77       77           
  Lines        3842     3842           
=======================================
  Hits         2187     2187           
  Misses       1655     1655           

Signed-off-by: Jakob Röhrl <jakob.roehrl@web.de>
@jakobroehrl jakobroehrl force-pushed the fix/compactModeOnLocalstorage branch from f6ab10f to ead0235 Compare May 20, 2020 07:45
@juliusknorr juliusknorr merged commit 733f1e7 into master May 20, 2020
@juliusknorr juliusknorr deleted the fix/compactModeOnLocalstorage branch May 20, 2020 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stay in compact mode

3 participants