Avatar for the gadget-inc user
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::instantiating a large union
CodSpeed Performance Gauge
+75%
101.6 µs58 µs

Passed

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

Ignored

plain mobx
bench/cross-framework.benchmark.ts::plain mobx
Ignored
CodSpeed Performance Gauge
-1%
282.4 µs284.7 µs
mobx-state-tree
bench/cross-framework.benchmark.ts::mobx-state-tree
Ignored
CodSpeed Performance Gauge
0%
1.5 ms1.5 ms
mobx-quick-tree types.model
bench/cross-framework.benchmark.ts::mobx-quick-tree types.model
Ignored
CodSpeed Performance Gauge
+1%
155.1 µs154.2 µs
plain es6
bench/cross-framework.benchmark.ts::plain es6
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
11 months 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
11 months ago
by airhorns
© 2025 CodSpeed Technology
Home Terms Privacy Docs