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

[bug] useStorage default value undefined get's written to localStorage and read as "undefined" #3595

Closed
7 tasks done
ByScripts opened this issue Nov 29, 2023 · 0 comments · Fixed by #3597
Closed
7 tasks done

Comments

@ByScripts
Copy link

Describe the bug

In fact it's the same bug as #597 but is about undefined instead of null.

The bug has been fixed by adding the condition if (defaultValue !== null).

But I wonder if the condition shouldn't have been if (defaultValue != null) instead, to support either null or undefined.

What do you think? Is it that simple?

Reproduction

https://play.vueuse.org/#N4IgDghgxg1hDmBTAziAXAbVAOwgW0XRADcBXRAWgBNE8BLEAGhGQHtSAnKQtEU7MDHhMQNZFA50wAFzqtsRAGrkABABFadFQAoAFhAA2AMxV1sKgGIdE2KLoCUp5CogqaxRAdZgz8FaVkDOmkATxcDLwB3ZxD2FWlWFUjJaUQVAFVsOg8OZEMVZTSAGToAIw4ISRQVI1YOAtUAJhUAMhUAZhFOAyJdaWkwZDQAemH+QXgAOihWPGGyShp6YaDS4bMaAA9JvAArVABfRhx8HhAAAQXSZERh5H1rKhE2Tm4icaERMQkpWXkiADKD0QVAaiHSN38gWCdBQky6HB6vD6AyGow+Uxmc0u5Gut3ulRB5wAjAAGSbEyak9bYLY7fYgI4nAhEHGIPHDGbWZ7sLhnDFfFA-GRyBS8ADCrAiiCgf3MrBMKBu2Fk+UKKkleDArGQMPkGWhshQCKRIBRgxGYwEQmms2GbI5XMQJPJlOpG0Q2z2hwAuswjHQDMa0KAAIJgMCTBboUCpLUGCCpIgAHio2QAfAAlTysCCg6S6OjOSBIeKJLx5tyJ1xGDizFQ3ZC6+QAhIVJCTZPDNPEdMAHWwqYzAAN+DQA9gQcOVHYZTA0CpgMAXMhMuOzCCVABeHf+WmICebgD8Kj7IEAoORnlQLs+AXg3ACy7V4OBy7Pf7g7fw+wpAi09nsAXJcVwAOR-Axt13b8IhUE8z0vEBr1PEAHyfF9uwzZ5hWkIg6C1OppEXfwbgBJVRVbOoEDSA4ajrPAVAAcgdG5OTqRB6IHAcZmwZACIgVd90PUEtyIxASKbMi20o7Qzz4igxwPDcqDPRg93XScqHsTj5B4kCwO3ESxObbByPbRBpJAWSoIMZSVCszTsC07ipUQSYvHgbQ+LXBT1KjQxyBUvjQIiXyDHIexGWfIA

System Info

System:
    OS: macOS 14.0
    CPU: (10) arm64 Apple M2 Pro
    Memory: 52.56 MB / 16.00 GB
    Shell: 3.6.1 - /opt/homebrew/bin/fish
  Binaries:
    Node: 21.2.0 - /opt/homebrew/bin/node
    Yarn: 1.22.19 - /opt/homebrew/bin/yarn
    npm: 10.2.3 - /opt/homebrew/bin/npm
    pnpm: 8.5.1 - ~/Library/pnpm/pnpm
    bun: 1.0.13 - /opt/homebrew/bin/bun
  Browsers:
    Brave Browser: 119.1.60.118
    Chrome: 119.0.6045.159
  npmPackages:
    @vueuse/core: ^10.1.2 => 10.6.1
    @vueuse/math: ^10.1.2 => 10.6.1
    vue: ^3.3.4 => 3.3.8

Used Package Manager

yarn

Validations

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

Successfully merging a pull request may close this issue.

1 participant