Skip to content

[pull] main from mobxjs:main - #65

Merged
pull[bot] merged 6 commits into
code:mainfrom
mobxjs:main
Aug 19, 2026
Merged

[pull] main from mobxjs:main#65
pull[bot] merged 6 commits into
code:mainfrom
mobxjs:main

Conversation

@pull

@pull pull Bot commented Aug 19, 2026

Copy link
Copy Markdown

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

mrpmohiburrahman and others added 6 commits August 19, 2026 13:19
… while serving a cached value (#4694)

Observation did not cascade, while unobservation always has. `isBeingObserved` was
set only on the observable handed to `reportObserved`, so a computed that gained an
observer without recomputing never re-reported its own dependencies and their
`onBO()` never fired.

Add `markObserved()`, which performs the transition and recurses through
`observing_`, and call it from `ComputedValue.get()` on the cache-hit branch only,
where the getter will not run and so will not re-report the dependencies itself.
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
* fix: ObservableSet.replace only emits events for actual changes

ObservableSet.replace previously cleared the set and re-added every
value, emitting a delete event for every existing element followed by
an add event for every replacement element - even when the contents
were unchanged. This also retriggered reactions unnecessarily.

It now deletes only the values that are not part of the replacement and
adds only the new ones (add/delete are already no-ops for unchanged
values), mirroring the behavior of ObservableMap.replace.

Closes #3761

* fix(set): address review feedback on ObservableSet.replace

Per review on #3761:

- Reuse `other` directly when it is already a Set instead of allocating a
  second one (observable sets are already snapshotted earlier and the Set is
  only read, never mutated).
- Short-circuit the trivial cases: an empty replacement is a plain `clear()`,
  and replacing into an empty set only needs the adds.
- Document the (observable) iteration-order change in the changeset: surviving
  values now keep their original position and new values are appended rather
  than the set being reordered to match the argument.
- Reorder the replacement arrays in the tests so they assert the resulting
  iteration order and cover the documented behavior change.

---------

Co-authored-by: Michel Weststrate <mweststrate@gmail.com>
…ds (#4695)

The generic esm outputs (dist/<pkg>.esm.js and dist/<pkg>.mjs) shipped every
__DEV__ check as a live process.env.NODE_ENV read (147 in mobx). process.env
is an exotic object in Node, so each read performs a real environment lookup,
which unbundled ESM consumers (Node SSR, vitest, RN dev) pay on hot paths.

For env-agnostic builds only: skip babel-plugin-dev-expression, rename the
free __DEV__ identifier to __MOBX_DEV__, and declare it once via output.intro.
All env-set artifacts are byte-identical; 2M observed writes drop from
3324ms to 319ms on Node 26.
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
… export condition (#4696)

Node ESM consumers previously always loaded dist/<pkg>.mjs: unminified,
dev-and-prod code decided per call by 147 live process.env.NODE_ENV reads,
and a second module instance for apps that also require('mobx') (#1082 class).

Adding a node condition (after react-native, before import) routes Node and
Bun to dist/index.js, the existing runtime switch over the prebaked
development/production CJS builds: single instance across import/require,
env-correct code, working named and default imports via cjs-module-lexer.
Bundler paths are unchanged (web ESM still gets .mjs, react-native still
gets .esm.js; verified with an enhanced-resolve@5 condition matrix); the
one disclosed change besides Node itself is bundlers targeting node, which
now bundle the CJS entry. attw: node16-from-ESM goes from 'masquerading as
CJS' to consistent CJS.
@pull pull Bot locked and limited conversation to collaborators Aug 19, 2026
@pull pull Bot added the ⤵️ pull label Aug 19, 2026
@pull
pull Bot merged commit 6f002b8 into code:main Aug 19, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants