- #59
58ccacf
Thanks @loganvolkers! - Improve handling for molecules that throw exceptions. This will no longer break the globaluse
functions, or breakgetMol
orgetScope
. Fixes #61
2.1.4 - 2024-03-06
Small fixes for browser compatibility.
- #52 - remove toSorted usage because of browser compatibility. Thanks @andrewdoro
2.1.3 - 2024-02-16
Fixes reactivity in the React ScopeProvider
- #50 - Fix the internals of
ScopeProvider
so that it is reactive. Thanks @OhSeungWan
2.1.2 - 2024-02-14
Minor release to fix bug in Firefox
- #48 - Fix the internals of Bunshi to not rely on
Symbol
as aWeakSet
key. Fixes firefox. - thanks @alexlag
2.1.1 - 2024-02-07
Minor release to fix bug in react useMolecule
- (React)
useMolecule
- When molecule returns a function, useMolecule should also return the same function #47 - thanks @3846masa
2.1.0 - 2024-01-22
Version 2.1.0 is a big update to Bunshi. It fixes a few key efficiency issues in #35 and #39. It introduces
the new use
syntax for wiring up dependencies, and the new onMount
and onUnmount
lifecycle events
for cleaning up dependencies, even when the state management libraries themselves don't have it.
In the process of preparing this release, the number of test cases was expanded dramatically to make sure that the lifecycle of bunshi molecules remains stable and predictable going forwards. Some behaviour that was implicit is now being explicitly tested for.
Big thank you to the community for the help.
- @davidisaaclee for highlighting the issue of molecules being run too frequently in #39
- @asfktz for playing with XState and promoting the creation of cleanup lifecycle in #35. Thanks @Andarist for the pointers.
- @00salmon for providing feedback on the release candidates
- Change to scoping. Object scopes will now be cleaned up, even for non-overlapping leases.
- Molecules callbacks are called more efficiently. Reduces the number of calls in many cases. Fixes #39. Thanks @davidisaaclee
onMount
andonUnmount
lifecycle hooks inside of molecules. Fixes #35. Thanks @asfktz- Support for React strict mode (and tests). Fixes #35
- New
use
syntax for depending on scopes or molecules, - Add methods to injector and scope for using lazily to support React strict mode
2.1.0-rc.2 - 2024-01-08
- Add methods to injector and scope for using lazily to support React strict mode
- Removed support for conditional dependencies. When detected, conditional dependencies will now throw an error.
- Removed
subscriptionId
from all calls (introduced in 2.1.0-rc.1)
2.1.0-rc.1 - 2023-11-23
- Change to scoping. Object scopes will now be cleaned up, even for non-overlapping leases.
- Molecules callbacks are called more efficiently. Reduces the number of calls in many cases. Fixes #39
- Injectors have new methods to pass along a
subscriptionId
to ensure that default scopes can be used and cleaned up.
onMount
andonUnmount
lifecycle hooks inside of molecules. Fixes #35- New
use
syntax for depending on scopes or molecules
2.0.2 - 2023-11-01
- Changed bundling to support splits in common JS. Fixes #29
2.0.1 - 2023-09-21
- Added
typesVersions
inpackage.json
to support older typescript versions
2.0.0 - 2023-09-20
Bunshi 2.0 is the next big release of jotai-molecules
. We were working on adding vue
support, and in the process realized that not only did
we not rely on any code from jotai
, but also that the concept of dependency injection for the frontend that we were working on was actually
useful for a number of different tools and libraries.
For vue
we realized that molecules are a useful way of sharing and scoping a ref
across an application. This is similar to the goals of pinia
,
but we could accomplish it in a more granular way without relying on strings keys.
We also saw that other tools like valtio
suffer from the need for memoization. Valtio recommends using useRef
for keeping a stable proxy scoped to
a component or a component tree.
So, instead of creating vue-molecules
and valtio-molecules
and others, we decided to keep it simple and rename our library.
The new name for jotai-molecules
is Bunshi. bunshi (分子, ぶんし) is the japanese word for molecule. Why bunshi? We are big fans of valtio
, zustand
and jotai
,
so we wanted to keep with the tradition of naming libraries using other languages. If you didn't now, zustand
is German for "state" and valtio
is Finnish for "state".
The other thing that is releasing at the same time here is our new documentation website. It's difficult to keep everything up to date in a single Readme, so we moved to a static site generator.
Moving for jotai-molecules
to bunshi
? To migrate change your imports from jotai-molecules
to bunshi/react
for example:
- import { useMolecule, molecule } from "jotai-molecules"
+ import { useMolecule, molecule } from "bunshi/react"
- Renamed from
jotai-molecules
tobunshi
- Default export no longer returns react. Users will need to change imports from
jotai-molecules
tobunshi/react
bunshi
Vanilla JS supportbunshi/vue
Vue supportbunshi/react
React-specific importcreateInjector
andgetDefaultInjector
to access internal statemoleculeInterface
for creating bindable interfacesComponentScope
for pushing state down into components- Documentation website
1.1.1 - 2023-04-20
- Updated license copyright to be in line with SaaSquatch open-source policy.
1.1.0 - 2022-05-31
- Added options for overriding scope in
useMolecule
. This removes the need forScopeProvider
in a number of cases.
1.0.3 - 2022-04-08
- Improve performance when using thousands of molecules
1.0.2 - 2022-04-08
- Fix bug with
ScopeProvider
where primitive values would not be cached - Add
displayName
to molecule and scope
1.0.1 - 2022-04-07
- Fix bug with
ScopeProvider
with nested scopes being undefined
1.0.0 - 2022-03-31
Initial release of jotai-molecules
molecule
for creating a molecule or dependent moleculeuseMolecule
a React hook for using a moleculecreateScope
for creating a scope for moleculesScopeProvider
a React component for providing scope to the tree