refactor: retire @action and get() from @ember/object - #613
Open
josemarluedke wants to merge 4 commits into
Open
josemarluedke wants to merge 4 commits into
josemarluedke wants to merge 4 commits into
Conversation
RFC 1234 deprecates the EmberObject object model. The standalone get() function is not in its table, but it is the likeliest next target. - getConfigOption: keys are flat, so plain property access is enough. - Field#fieldValue: needs dotted paths, so it now uses a small getPath helper that reads own properties only and refuses __proto__, constructor and prototype segments, since field names can come from untrusted schemas. The unsafe-key list moves to -private/unsafe-keys so nested-data and getPath share it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Follows RFC 1045, which stops teaching @action in favour of arrow functions assigned to class fields. The co-located component docs are converted too, because Docfy renders their code fences as live demos and they are what consumers copy. No action is overridden through super, and no class-field initializer reads an action declared below it, so the conversion is behaviour- preserving; changeset-form's validate overrides stay working because base and subclasses are both fields. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ite and test-app Same conversion as the packages, per RFC 1045. The guide docs' code fences are live Docfy demos, so they now teach the arrow form. The application route's didTransition keeps @action: it is a router event, looked up in the route's actions hash, which an arrow field is not part of. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
✅ Deploy Preview for frontile-next ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
getPath is the read-side partner of flattenData/unflattenData, so it now lives beside them and reuses the module's own isUnsafeKey. That removes the separate get-path and -private/unsafe-keys modules, and puts the prototype-pollution rationale back next to the walk it describes. It is exported alongside the other nested-data helpers. It also stops requiring own properties. @Tracked fields and getters are accessors on the prototype, so a class-instance formData rendered empty fields; Ember's get() read them. Unsafe segments are still refused, including an own __proto__ key such as JSON.parse produces. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Retires the two
@ember/objectAPIs Frontile still uses, following two open Ember RFCs:@actionand teaches arrow-function class fields instead. It does not deprecate@action.EmberObjectand its object model. Its table does not name the standaloneget()function, butget()reads through that object model, so it is the likeliest next target.Frontile uses nothing else on RFC 1234's list. Glimmer components define their own
willDestroy/isDestroying/isDestroyed, which the RFC does not touch and@glimmer/component's docs still teach, so those are left alone. The same goes forguidForand theApplication.create()boot calls.Commits
get()withgetPath(plus a follow-up commit from/simplify).getConfigOptionkeys are flat, so it now uses plain property access.Field#fieldValueneeds dotted paths, so it uses a newgetPathinutils/nested-data.ts. That puts it next toflattenData/unflattenData, and it is exported with them. It is a small public API addition.@trackedfields and getters on class-instanceformDatawork as they did withget().__proto__/constructor/prototypesegments, including an own__proto__key like the oneJSON.parseproduces. Field names can come from untrusted schemas, and Ember'sget()would follow those segments toObject.prototype.@action→ arrow fields inpackages/*/src, including the co-located component.mdfiles. Docfy renders those as live demos, and they are what consumers copy.docs/,site/app, andtest-app.Review notes
site/app/routes/application.tsdidTransitionkeeps@action. It is a router event, looked up in the route'sactionshash, and an arrow field is not in that hash.name = [async] (params): Ret => {) and turns closing}into};. Added and removed lines match one for one.undefined. I checked everythis.<action>that appears above its declaration, and all of them are inside methods, callbacks, or templates.super.changeset-form'svalidateoverrides still work because the base class and its subclasses are all fields.Verification
pnpm buildlint:typesis clean forfrontile,changeset-form, andforms-legacy.field.gts/form.gts/native-select.gtsand the site/test-app type errors all exist onmainand are on lines this PR does not change.🤖 Generated with Claude Code