-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
feat(console): persist auto-scroll toggle state in localStorage #8024
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -63,7 +63,7 @@ export default { | |
| }, | ||
| data() { | ||
| return { | ||
| autoScrollEnabled: true, | ||
| autoScrollEnabled: localStorage.getItem('console_auto_scroll') !== 'false', | ||
| pipDialog: false, | ||
| pipInstallPayload: { | ||
| package: '', | ||
|
|
@@ -75,6 +75,7 @@ export default { | |
| }, | ||
| watch: { | ||
| autoScrollEnabled(val) { | ||
| localStorage.setItem('console_auto_scroll', val); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| if (this.$refs.consoleDisplayer) { | ||
| this.$refs.consoleDisplayer.autoScroll = val; | ||
| } | ||
|
Comment on lines
77
to
81
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Accessing
localStoragecan throw an error if it is disabled or restricted in the user's browser. It is safer to wrap this call in atry-catchblock to prevent the component from failing to mount.