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(utils): atomWithStorage to always run onMount #2455

Merged
merged 1 commit into from
Mar 15, 2024

Conversation

dai-shi
Copy link
Member

@dai-shi dai-shi commented Mar 15, 2024

#2447 (comment)

createStorage caches the last value, so this should be fine for most cases.

Copy link

vercel bot commented Mar 15, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
jotai ✅ Ready (Inspect) Visit Preview Mar 15, 2024 4:19am

Copy link

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Copy link

Size Change: -28 B (0%)

Total Size: 72.6 kB

Filename Size Change
dist/system/vanilla/utils.development.js 4.91 kB -5 B (0%)
dist/system/vanilla/utils.production.js 3 kB -3 B (0%)
dist/umd/vanilla/utils.development.js 5.82 kB -8 B (0%)
dist/umd/vanilla/utils.production.js 3.6 kB -3 B (0%)
dist/vanilla/utils.js 5.68 kB -9 B (0%)
ℹ️ View Unchanged
Filename Size
dist/babel/plugin-debug-label.js 907 B
dist/babel/plugin-react-refresh.js 1.14 kB
dist/babel/preset.js 1.38 kB
dist/index.js 242 B
dist/react.js 1.06 kB
dist/react/utils.js 1.26 kB
dist/system/babel/plugin-debug-label.development.js 1.09 kB
dist/system/babel/plugin-debug-label.production.js 757 B
dist/system/babel/plugin-react-refresh.development.js 1.29 kB
dist/system/babel/plugin-react-refresh.production.js 929 B
dist/system/babel/preset.development.js 1.56 kB
dist/system/babel/preset.production.js 1.13 kB
dist/system/index.development.js 253 B
dist/system/index.production.js 182 B
dist/system/react.development.js 1.18 kB
dist/system/react.production.js 711 B
dist/system/react/utils.development.js 722 B
dist/system/react/utils.production.js 461 B
dist/system/utils.development.js 258 B
dist/system/utils.production.js 188 B
dist/system/vanilla.development.js 4.38 kB
dist/system/vanilla.production.js 2.23 kB
dist/umd/babel/plugin-debug-label.development.js 1.06 kB
dist/umd/babel/plugin-debug-label.production.js 845 B
dist/umd/babel/plugin-react-refresh.development.js 1.28 kB
dist/umd/babel/plugin-react-refresh.production.js 1.01 kB
dist/umd/babel/preset.development.js 1.53 kB
dist/umd/babel/preset.production.js 1.24 kB
dist/umd/index.development.js 381 B
dist/umd/index.production.js 329 B
dist/umd/react.development.js 1.18 kB
dist/umd/react.production.js 785 B
dist/umd/react/utils.development.js 1.43 kB
dist/umd/react/utils.production.js 1.03 kB
dist/umd/utils.development.js 398 B
dist/umd/utils.production.js 343 B
dist/umd/vanilla.development.js 5.24 kB
dist/umd/vanilla.production.js 2.81 kB
dist/utils.js 246 B
dist/vanilla.js 5.16 kB

compressed-size-action

Copy link

LiveCodes Preview in LiveCodes

Latest commit: ba4e4e3
Last updated: Mar 15, 2024 4:19am (UTC)

Playground Link
React demo https://livecodes.io?x=id/2S2MUSZ5Y

See documentations for usage instructions.

@dai-shi dai-shi added this to the v2.7.1 milestone Mar 15, 2024
@dai-shi dai-shi merged commit 09fc0e2 into main Mar 15, 2024
34 checks passed
@dai-shi dai-shi deleted the fix/utils/atom-with-storage branch March 15, 2024 04:25
renovate bot referenced this pull request in turtton/volglass Mar 17, 2024
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [@biomejs/biome](https://biomejs.dev)
([source](https://togithub.com/biomejs/biome/tree/HEAD/packages/@biomejs/biome))
| [`1.5.3` ->
`1.6.1`](https://renovatebot.com/diffs/npm/@biomejs%2fbiome/1.5.3/1.6.1)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/@biomejs%2fbiome/1.6.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@biomejs%2fbiome/1.6.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@biomejs%2fbiome/1.5.3/1.6.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@biomejs%2fbiome/1.5.3/1.6.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
|
[@types/node](https://togithub.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node)
([source](https://togithub.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node))
| [`18.19.22` ->
`18.19.24`](https://renovatebot.com/diffs/npm/@types%2fnode/18.19.22/18.19.24)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/@types%2fnode/18.19.24?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@types%2fnode/18.19.24?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@types%2fnode/18.19.22/18.19.24?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@types%2fnode/18.19.22/18.19.24?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
|
[@types/react](https://togithub.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react)
([source](https://togithub.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/react))
| [`18.2.64` ->
`18.2.66`](https://renovatebot.com/diffs/npm/@types%2freact/18.2.64/18.2.66)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/@types%2freact/18.2.66?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@types%2freact/18.2.66?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@types%2freact/18.2.64/18.2.66?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@types%2freact/18.2.64/18.2.66?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
|
[@types/react-dom](https://togithub.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-dom)
([source](https://togithub.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/react-dom))
| [`18.2.21` ->
`18.2.22`](https://renovatebot.com/diffs/npm/@types%2freact-dom/18.2.21/18.2.22)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/@types%2freact-dom/18.2.22?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@types%2freact-dom/18.2.22?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@types%2freact-dom/18.2.21/18.2.22?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@types%2freact-dom/18.2.21/18.2.22?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
| [jotai](https://togithub.com/pmndrs/jotai) | [`2.7.0` ->
`2.7.1`](https://renovatebot.com/diffs/npm/jotai/2.7.0/2.7.1) |
[![age](https://developer.mend.io/api/mc/badges/age/npm/jotai/2.7.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/jotai/2.7.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/jotai/2.7.0/2.7.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/jotai/2.7.0/2.7.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
| [postcss](https://postcss.org/)
([source](https://togithub.com/postcss/postcss)) | [`8.4.35` ->
`8.4.36`](https://renovatebot.com/diffs/npm/postcss/8.4.35/8.4.36) |
[![age](https://developer.mend.io/api/mc/badges/age/npm/postcss/8.4.36?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/postcss/8.4.36?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/postcss/8.4.35/8.4.36?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/postcss/8.4.35/8.4.36?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
|
[org.jetbrains.kotlin-wrappers:kotlin-wrappers-bom](https://togithub.com/JetBrains/kotlin-wrappers)
| `1.0.0-pre.710` -> `1.0.0-pre.715` |
[![age](https://developer.mend.io/api/mc/badges/age/maven/org.jetbrains.kotlin-wrappers:kotlin-wrappers-bom/1.0.0-pre.715?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/maven/org.jetbrains.kotlin-wrappers:kotlin-wrappers-bom/1.0.0-pre.715?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/maven/org.jetbrains.kotlin-wrappers:kotlin-wrappers-bom/1.0.0-pre.710/1.0.0-pre.715?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/maven/org.jetbrains.kotlin-wrappers:kotlin-wrappers-bom/1.0.0-pre.710/1.0.0-pre.715?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>biomejs/biome (@&#8203;biomejs/biome)</summary>

###
[`v1.6.1`](https://togithub.com/biomejs/biome/blob/HEAD/CHANGELOG.md#161-2024-03-12)

[Compare
Source](https://togithub.com/biomejs/biome/compare/560628b380b0b1f61303c8e5ca2175d3b4794089...4ed1cbe96bc9e6d7092e88dd0a54ff8ce78037e5)

##### CLI

##### Bug fixes

- CLI is now able to automatically search and resolve `biome.jsonc`
([#&#8203;2008](https://togithub.com/biomejs/biome/issues/2008)).
Contributed by [@&#8203;Sec-ant](https://togithub.com/Sec-ant)
- Fix a false positive where some files were counted as "fixed" even
though they weren't modified. Contributed by
[@&#8203;ematipico](https://togithub.com/ematipico)

##### Configuration

##### Bug fixes

- `json.formatter.trailingCommas` option now works in `overrides`
([#&#8203;2009](https://togithub.com/biomejs/biome/issues/2009)).
Contributed by [@&#8203;Sec-ant](https://togithub.com/Sec-ant)

##### Linter

##### New features

- Add rule
[noDoneCallback](https://biomejs.dev/linter/rules/no-done-callback),
this rule checks the function parameter of hooks & tests
for use of the done argument, suggesting you return a promise instead.
Contributed by [@&#8203;vasucp1207](https://togithub.com/vasucp1207)

    ```js
    beforeEach(done => {
      // ...
    });
    ```

##### Bug fixes

-
[useJsxKeyInIterable](https://biomejs.dev/linter/rules/use-jsx-key-in-iterable)
now recognizes function bodies wrapped in parentheses
([#&#8203;2011](https://togithub.com/biomejs/biome/issues/2011)).
Contributed by [@&#8203;Sec-ant](https://togithub.com/Sec-ant)

-
[useShorthandFunctionType](https://biomejs.dev/linter/rules/use-shorthand-function-type)
now preserves type parameters of generic interfaces when applying fixes
([#&#8203;2015](https://togithub.com/biomejs/biome/issues/2015)).
Contributed by [@&#8203;Sec-ant](https://togithub.com/Sec-ant)

- Code fixes of
[useImportType](https://biomejs.dev/linter/rules/use-import-type) and
[useExportType](https://biomejs.dev/linter/rules/use-export-type) now
handle multiline statements
([#&#8203;2041](https://togithub.com/biomejs/biome/issues/2041)).
Contributed by [@&#8203;Conaclos](https://togithub.com/Conaclos)

- [noRedeclare](https://biomejs.dev/linter/rules/no-redeclare) no longer
reports type parameter and parameter with identical names
([#&#8203;1992](https://togithub.com/biomejs/biome/issues/1992)).

    The following code is no longer reported:

    ```ts
    function f<a>(a: a) {}
    ```

    Contributed by [@&#8203;Conaclos](https://togithub.com/Conaclos)

- [noRedeclare](https://biomejs.dev/linter/rules/no-redeclare) now
reports duplicate type parameters in a same declaration.

    The following type parameters are now reported as a redeclaraion:

    ```ts
    function f<T, T>() {}
    ```

    Contributed by [@&#8203;Conaclos](https://togithub.com/Conaclos)

-
[noUndeclaredDependencies](https://biomejs.dev/linter/rules/no-undeclared-dependencies/)
now recognizes imports of subpath exports.

E.g., the following import statements no longer report errors if
`@mui/material` and `tailwindcss` are installed as dependencies:

    ```ts
    import Button from "@&#8203;mui/material/Button";
    import { fontFamily } from "tailwindcss/defaultTheme";
    ```

    Contributed by [@&#8203;Sec-ant](https://togithub.com/Sec-ant)

##### Parser

##### Bug fixes

- JavaScript lexer is now able to lex regular expression literals with
escaped non-ascii chars
([#&#8203;1941](https://togithub.com/biomejs/biome/issues/1941)).

    Contributed by [@&#8203;Sec-ant](https://togithub.com/Sec-ant)

###
[`v1.6.0`](https://togithub.com/biomejs/biome/blob/HEAD/CHANGELOG.md#160-2024-03-08)

[Compare
Source](https://togithub.com/biomejs/biome/compare/906de83449b5066554cd8e97c78a1f8e43749016...560628b380b0b1f61303c8e5ca2175d3b4794089)

##### Analyzer

##### New features

- Add partial for `.astro` files. Biome is able to sort imports inside
the frontmatter of the Astro files. Contributed
    by [@&#8203;ematipico](https://togithub.com/ematipico)

</details>

<details>
<summary>pmndrs/jotai (jotai)</summary>

### [`v2.7.1`](https://togithub.com/pmndrs/jotai/releases/tag/v2.7.1)

[Compare
Source](https://togithub.com/pmndrs/jotai/compare/v2.7.0...v2.7.1)

This fixes a regression in v2.7.0.

#### What's Changed

- fix(vanilla): store should flush pending write triggered
asynchronously and indirectly by
[@&#8203;iwoplaza](https://togithub.com/iwoplaza) in
[https://github.com/pmndrs/jotai/pull/2451](https://togithub.com/pmndrs/jotai/pull/2451)
- fix(utils): atomWithStorage to always run onMount by
[@&#8203;dai-shi](https://togithub.com/dai-shi) in
[https://github.com/pmndrs/jotai/pull/2455](https://togithub.com/pmndrs/jotai/pull/2455)

#### New Contributors

- [@&#8203;rothsandro](https://togithub.com/rothsandro) made their first
contribution in
[https://github.com/pmndrs/jotai/pull/2426](https://togithub.com/pmndrs/jotai/pull/2426)
- [@&#8203;NehalDamania](https://togithub.com/NehalDamania) made their
first contribution in
[https://github.com/pmndrs/jotai/pull/2441](https://togithub.com/pmndrs/jotai/pull/2441)
- [@&#8203;tien](https://togithub.com/tien) made their first
contribution in
[https://github.com/pmndrs/jotai/pull/2446](https://togithub.com/pmndrs/jotai/pull/2446)
- [@&#8203;ashuvssut](https://togithub.com/ashuvssut) made their first
contribution in
[https://github.com/pmndrs/jotai/pull/2445](https://togithub.com/pmndrs/jotai/pull/2445)

**Full Changelog**:
pmndrs/jotai@v2.7.0...v2.7.1

</details>

<details>
<summary>postcss/postcss (postcss)</summary>

###
[`v8.4.36`](https://togithub.com/postcss/postcss/blob/HEAD/CHANGELOG.md#8436)

[Compare
Source](https://togithub.com/postcss/postcss/compare/8.4.35...e5ad9394daf38d0ef4acd7065f219b3cddace1df)

- Fixed `original.column are not numbers` error on broken previous
source map.

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "after 1pm and before 5pm on Friday"
in timezone Asia/Tokyo, Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get
[config help](https://togithub.com/renovatebot/renovate/discussions) if
that's undesired.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/turtton/volglass).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4yNDUuMCIsInVwZGF0ZWRJblZlciI6IjM3LjI0NS4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
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 this pull request may close these issues.

1 participant