Skip to content

feat(core): add origin to PropertyChangeData - #11412

Open
edusperoni wants to merge 1 commit into
mainfrom
feat/property-change-origin
Open

edusperoni wants to merge 1 commit into
mainfrom
feat/property-change-origin

Conversation

@edusperoni

Copy link
Copy Markdown
Contributor

PR Checklist

What is the current behavior?

A programmatic set and a native-originated change (for example the user typing into a TextField) emit the same <name>Change event with identical PropertyChangeData. Listeners cannot tell user input apart from framework or application writes, nor from values applied by CSS, inheritance or keyframe animations. Two-way bindings and apps work around this with ad-hoc guards, and frameworks see their own writes echoed back as "changes".

What is the new behavior?

PropertyChangeData gains an optional origin field, typed by the new exported PropertyChangeOrigin alias:

origin Emitted by
script Property/CoercibleProperty setters, InheritedProperty local writes, CssProperty local writes (style.color = …), CssAnimationProperty local writes, InheritedCssProperty local writes
native Property.nativeValueChange (the native view reported a value)
css CssProperty/CssAnimationProperty/InheritedCssProperty css: writes from the style cascade
inherited InheritedProperty/InheritedCssProperty propagation from the parent
animation CssAnimationProperty keyframe writes

Plain Observable.notifyPropertyChange (view models) leaves origin undefined. Shorthand expansions carry the shorthand's origin into each longhand event.

This is additive: no event timing, ordering or payload shape changes; existing listeners are unaffected. Property.set accepts an optional second origin argument so InheritedProperty can thread its source through the base setter; property descriptors still invoke it with one argument.

Tests: ui/core/properties/property-change-origin.spec.ts (12 cases) covers every origin and the shorthand and view-model cases.

This is the first, independent piece of a larger native-updates redesign (scheduler/commit hook to follow in a separate draft PR).

@nx-cloud

nx-cloud Bot commented Sep 3, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit 6c86476

Command Status Duration Result
nx test apps-automated -c=ios ✅ Succeeded 2m 16s View ↗
nx run-many --target=test --configuration=ci --... ✅ Succeeded 1s View ↗

💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-09-03 19:42:06 UTC

@pkg-pr-new

pkg-pr-new Bot commented Sep 3, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@nativescript/core@11412
npm i https://pkg.pr.new/@nativescript/vite@11412
npm i https://pkg.pr.new/@nativescript/webpack@11412

commit: 6c86476

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant