Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

storeHooks minor improvement #2970

Conversation

dmaskasky
Copy link
Collaborator

@dmaskasky dmaskasky commented Feb 3, 2025

Summary

Return delete function from add in storeHooks.

  • improves ergonomics
  • reduces bundle size

Check List

  • pnpm run fix:format for formatting code and docs

Copy link

vercel bot commented Feb 3, 2025

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

Name Status Preview Comments Updated (UTC)
jotai ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 3, 2025 6:46am

Copy link

codesandbox-ci bot commented Feb 3, 2025

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

pkg-pr-new bot commented Feb 3, 2025

Open in Stackblitz

More templates

npm i https://pkg.pr.new/jotai@2970

commit: 83be59a

Copy link

github-actions bot commented Feb 3, 2025

LiveCodes Preview in LiveCodes

Latest commit: 83be59a
Last updated: Feb 3, 2025 6:46am (UTC)

Playground Link
React demo https://livecodes.io?x=id/7RE32AJP8

See documentations for usage instructions.

@dmaskasky dmaskasky changed the base branch from main to feat/core/expose-internals-instead-of-derive February 3, 2025 06:31
@dmaskasky dmaskasky requested a review from dai-shi February 3, 2025 06:31
Copy link
Member

@dai-shi dai-shi left a comment

Choose a reason for hiding this comment

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

LGTM otherwise

@dai-shi dai-shi merged commit 7aaf1a9 into pmndrs:feat/core/expose-internals-instead-of-derive Feb 3, 2025
44 checks passed
dai-shi added a commit that referenced this pull request Feb 11, 2025
* wip: expose internal functions

* rename

* tests following the change

* separate internals entrypoint

* fix entries

* fix for umd, still wip

* revert them

* revert changes

* rename readme

* internals entry point

* impl

* fix store test

* derive test

* effect test

* fix rollup config

* hack types

* fix workflow files

* fix workflow files again

* hack types again

* fix rollup config

* ts ignore

* tried this?

* test: rename

* follow the change

* I think this is unnecessary

* fix AtomState type

* do not enumerate secret methods

* even better

* refactor

* another refactor

* wip: building-block functions

* give up scope tests for now

* some more refactors

* fix workflow file

* use symbol instead of weakmap for cancelable promise

* fix typo

* expose util and tentative functions

* does this fix?

* catch error from f hook

* only keeps one error

* do we want to support falsy errors?

* going back the circle

* store hook for atoms util

* does this help?

* for ts3.9

* store hooks tweaks (#2969)

* lazy assign store hooks internally

* initializeStoreHooks

* make it work with node 18

* refactor(internals): isolated mounted map in store (#2967)

* refactor(internals): isolated mounted map in store

* give up derive test

* rev4 compatibility

* a silly mistake

* storeHooks minor improvement (#2970)

* storeHooks: return delete function from add

* Update src/vanilla/internals.ts

---------

Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com>

* refactor(internals): store state in store args (#2972)

* refactor(internals): atomStateMap in storeState

* store args for everything and create building blocks

* createStoreArgs

* refactor

* refactor and type

* export internal types

* simplify types

* prefer readonly modifier

* expose building blocks

* elminate store args

* expose building blocks (#2974)

* expose building blocks

* elminate store args

* move top-level functions to createBuildingBlocks and add some organization

* tweak createBuildingBlocks

* update store and tests invocation of INTERNAL_createBuildingBlocks

* fix lint and decomposition

* refactor(internals): simplify building blocks

---------

Co-authored-by: daishi <daishi@axlight.com>

* comments

* customizable building blocks

* ts hack

* ts hack 2

* minor change

* nice to remove !

* refactor

* full building blocks (#2977)

* return a complete building blocks array

* return mutable building blocks

* revert to default function argument style

---------

Co-authored-by: daishi <daishi@axlight.com>

---------

Co-authored-by: David Maskasky <dmaskasky@gmail.com>
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants