| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
Pin the native call sequences, their order and the <name>Change timing that the native-update rework has to keep, plus a hot-path timing probe for I6.
The six copies of the suspend-or-apply block now share one routing helper, and the native default capture exists in one place instead of eight.
|
View your CI Pipeline Execution ↗ for commit 6aad60a
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗ ☁️ Nx Cloud last updated this comment at 2026-09-05 17:34:32 UTC |
Sorry, something went wrong.
npm i https://pkg.pr.new/@nativescript/core@11414 npm i https://pkg.pr.new/@nativescript/vite@11414 npm i https://pkg.pr.new/@nativescript/webpack@11414 commit: 6aad60a |
Sorry, something went wrong.
| export type NativeUpdateProperty = Property<any, any> | CssProperty<any, any> | CssAnimationProperty<any, any>; | ||
|
|
||
| /** What a commit applies: a property, through its `[setNative]`, or an aggregate invalidation. */ | ||
| export type NativeUpdateTarget = NativeUpdateProperty | Invalidation; |
There was a problem hiding this comment.
i have doubt about the name. Target often refer to an View in Nativescript. at first i could not find where the "property" array was in NativeUpdateBatch. Could we rename it to something more obvious?
Sorry, something went wrong.
A resume now builds a batch of everything dirty on the node and hands it to commitNativeUpdates, which a class can override to order its own native writes.
batch()/begin()/end() coalesce the writes made to each node into one commit, and flushNativeUpdates pushes what is pending, optionally past the loaded hold.
A property can name aggregate invalidations it raises; the node's commit runs each one's handler once, after the properties, however many of them raised it.
A node using the default commit hook with no aggregate invalidations pending cannot reach the batch, so the commit sweeps the dirty set directly instead of building one.
| Back | FazBrowse Home | New Git URL |
PR Checklist
What is the current behavior?
A property setter is the native call. Each Property/CssProperty/CssAnimationProperty/InheritedCssProperty setter carries its own copy of the "suspended → record in _suspendedUpdates, else [setNative](value)" block (six copies). The first native pass happens at onLoaded in the order properties were first set on that instance; afterwards every set is one synchronous native call. There is no way for a widget to see "these properties changed together", no previous committed value, no public batching primitive (_batchUpdate is private and per node), and no way for a flavor to coalesce writes across nodes.
What is the new behavior?
Phase 0 of the native-updates redesign: additive plumbing with no behavior change. The new API is implemented on top of the existing storage (_suspendNativeUpdatesCount as the holds, _suspendedUpdates as the dirty set), so every existing code path produces the same native calls, in the same order, with the same <name>Change timing. Six commits, each green on its own; review commit by commit:
Fast path. A live set on a class that does not override commitNativeUpdates, with no aggregate invalidations and no open batch, still calls [setNative] straight from the setter with no allocation.
Legacy surface kept (names, types, exports, semantics): _suspendNativeUpdatesCount, _suspendedUpdates, SuspendType (moved to view-base/suspend-type.ts, still internal), _batchUpdate, _suspendNativeUpdates, _resumeNativeUpdates, onResumeNativeUpdates, initNativeView, applyPendingNativeSetters, applyAllNativeSetters, affectsLayout timing.
Points for reviewers
Cost, measured jitless (VITEST_NO_OPT=1, interpreter-only like iOS) with a no-op setNative, medians. Live setter: roughly +40–60 ns per set from collapsing six inlined copies into one routing call (JIT: within noise); a real native write is microseconds, so the relative impact in apps is far smaller. Commit path (per view, µs), base → without commit 6 → with commit 6:
The residual over base is two helper calls per property in the sweep; inlining the default-capture into those helpers would recover most of it at the cost of duplicating it, deliberately not done in Phase 0. The setter numbers live in native-updates-hot-path.spec.ts, the commit-path ones in native-updates-commit-cost.spec.ts; both print on every run.
invalidates is additive: a property that declares it still runs its own [setNative], then the aggregates. Whether aggregates should replace the property's own setter is a Phase 1 decision.
Dirty state is cleared before the commit runs, so a write made from a handler queues against a fresh set (previously the set was replaced after the sweep). Only observable if a setNative handler runs _batchUpdate on the same node mid-sweep.
Property.set with an override present routes through the commit and uses pending semantics (value re-read at commit). Only affects classes that opt in.
Device tests (apps/automated/src/ui/lifecycle/lifecycle-tests.ts: NativeUpdates.batch equals _batchUpdate counts, flush inside a batch, forced flush while unloaded) are added but were not run here. The existing lifecycle suite there asserts exact setNative counts through XML inflation, _batchUpdate, navigation and CSS class changes and is the production check for "same native calls". To run on iOS and Android before undrafting.
Tests: 485 → 557 passing (npx vitest run in packages/core), no pre-existing failures. Typecheck: npx tsc -p packages/core/tsconfig.lib.json --noEmit clean.
Related: #11412 (origin on PropertyChangeData, independent), #11413 (InheritedProperty reset cascade fix, found on the way).