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

Additional quotes around strings #639

Open
joshmakar opened this issue Apr 8, 2022 · 1 comment
Open

Additional quotes around strings #639

joshmakar opened this issue Apr 8, 2022 · 1 comment

Comments

@joshmakar
Copy link

Describe the bug
It seems like when a string value is stored, it's being stored with additional quotes around the string.

To Reproduce
Steps to reproduce the behavior:

  1. Create the computed variable:
computed: {
    applicationTheme: preference('applicationTheme', { defaultValue: 'default' }),
}
  1. Set it to something:
methods: {
    toggleDarkTheme() {
        this.applicationTheme = this.applicationTheme === 'default' ? 'dark' : 'default';
    }
}
  1. Get the value from local storage (not using Vue/Vue-Preferences):
const applicationTheme = localStorage.getItem("applicationTheme");
// Value is equal to "default" or "dark", not default or dark

Expected behavior
The value shouldn't be surrounded by quotes.

Screenshots
image

Desktop (please complete the following information):

  • OS: Windows 10
  • Browser Chrome
  • Version latest
@atalagorria
Copy link

@joshmakar I don't think the issue is that the value is surrounded by quotes. Did you try to use the get() method to retrieve the value?

toggleDarkTheme() {
  const currentTheme = preference("applicationTheme").get();
  preference("applicationTheme").set(
    currentTheme === "default" ? "dark" : "default"
  );
},

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants