gadget-inc
mobx-quick-tree
BlogDocsChangelog

Add support for acceptsUndefined: false to safe references

#109Merged
Comparing
accepts-undefined
(
5488410
) with
accepts-undefined
(
330abed
)
CodSpeed Performance Gauge
+75%
Improvements
1
Untouched
10
Ignored
4

Benchmarks

Improved

instantiating a large union
bench/create-union.benchmark.ts
CodSpeed Performance Gauge
+75%
101.6 µs58 µs

Passed

instantiating a small root
bench/instantiation.benchmark.ts
CodSpeed Performance Gauge
+7%
23.3 µs21.8 µs
instantiating a large root
bench/instantiation.benchmark.ts
CodSpeed Performance Gauge
+4%
2.6 ms2.5 ms
instantiating one reference
bench/create-references.benchmark.ts
CodSpeed Performance Gauge
+4%
41.5 µs39.9 µs
mobx-quick-tree ClassModel
bench/cross-framework.benchmark.ts
CodSpeed Performance Gauge
+4%
43 µs41.5 µs
accessing memoized null property of a class model
bench/property-access.benchmark.ts
CodSpeed Performance Gauge
+4%
9.9 µs9.6 µs
instantiating a diverse root
bench/instantiation.benchmark.ts
CodSpeed Performance Gauge
+3%
56.5 µs55.1 µs
instantiating deep references
bench/create-references.benchmark.ts
CodSpeed Performance Gauge
+2%
92.7 µs90.6 µs
accessing unmemoized getter properties of a class model
bench/property-access.benchmark.ts
CodSpeed Performance Gauge
0%
14.9 µs14.9 µs
accessing memoized getter properties of a class model
bench/property-access.benchmark.ts
CodSpeed Performance Gauge
-1%
11.2 µs11.3 µs
accessing unmemoized null property of a class model
bench/property-access.benchmark.ts
CodSpeed Performance Gauge
-2%
10.8 µs11 µs

Ignored

mobx-state-tree
bench/cross-framework.benchmark.ts
Ignored
CodSpeed Performance Gauge
0%
1.5 ms1.5 ms
plain mobx
bench/cross-framework.benchmark.ts
Ignored
CodSpeed Performance Gauge
-1%
282.4 µs284.7 µs
mobx-quick-tree types.model
bench/cross-framework.benchmark.ts
Ignored
CodSpeed Performance Gauge
+1%
155.1 µs154.2 µs
plain es6
bench/cross-framework.benchmark.ts
Ignored
CodSpeed Performance Gauge
+1%
16.1 µs16 µs

Commits

Click on a commit to change the comparison range
Base
accepts-undefined
330abed
-40.31%
Add support for acceptsUndefined: false to safe references MST proper supports an `acceptsUndefined: false` on safe references that automatically prunes invalid references from parent maps and arrays. I wanna use it in Gadget but noticed that it no worky -- we pass the option through to observable instances fine but didn't do anything with it in readonly instances. This adds handling for the special case, which requires arrays and maps to look at the child type, and if it is a safe reference with the option set, omit unresolved entries from the result. Woop woop.
330abed
1 year ago
by airhorns
×2.2
Add support for acceptsUndefined: false to safe references MST proper supports an `acceptsUndefined: false` on safe references that automatically prunes invalid references from parent maps and arrays. I wanna use it in Gadget but noticed that it no worky -- we pass the option through to observable instances fine but didn't do anything with it in readonly instances. This adds handling for the special case, which requires arrays and maps to look at the child type, and if it is a safe reference with the option set, omit unresolved entries from the result. Woop woop.
5488410
1 year ago
by airhorns
© 2025 CodSpeed Technology
Home Terms Privacy Docs