Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tracked-built-ins built-in, unblocking (array), (hash) #1068

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

NullVoxPopuli
Copy link
Contributor

@NullVoxPopuli NullVoxPopuli commented Jan 12, 2025

Propose making tracked-built-ins built-in, which unblocks the implementations of #1000 (array) and #999 (hash)

Rendered

Summary

This pull request is proposing a new RFC.

To succeed, it will need to pass into the Exploring Stage, followed by the Accepted Stage.

A Proposed or Exploring RFC may also move to the Closed Stage if it is withdrawn by the author or if it is rejected by the Ember team. This requires an "FCP to Close" period.

An FCP is required before merging this PR to advance to Accepted.

Upon merging this PR, automation will open a draft PR for this RFC to move to the Ready for Released Stage.

Exploring Stage Description

This stage is entered when the Ember team believes the concept described in the RFC should be pursued, but the RFC may still need some more work, discussion, answers to open questions, and/or a champion before it can move to the next stage.

An RFC is moved into Exploring with consensus of the relevant teams. The relevant team expects to spend time helping to refine the proposal. The RFC remains a PR and will have an Exploring label applied.

An Exploring RFC that is successfully completed can move to Accepted with an FCP is required as in the existing process. It may also be moved to Closed with an FCP.

Accepted Stage Description

To move into the "accepted stage" the RFC must have complete prose and have successfully passed through an "FCP to Accept" period in which the community has weighed in and consensus has been achieved on the direction. The relevant teams believe that the proposal is well-specified and ready for implementation. The RFC has a champion within one of the relevant teams.

If there are unanswered questions, we have outlined them and expect that they will be answered before Ready for Release.

When the RFC is accepted, the PR will be merged, and automation will open a new PR to move the RFC to the Ready for Release stage. That PR should be used to track implementation progress and gain consensus to move to the next stage.

Checklist to move to Exploring

  • The team believes the concepts described in the RFC should be pursued.
  • The label S-Proposed is removed from the PR and the label S-Exploring is added.
  • The Ember team is willing to work on the proposal to get it to Accepted

Checklist to move to Accepted

  • This PR has had the Final Comment Period label has been added to start the FCP
  • The RFC is announced in #news-and-announcements in the Ember Discord.
  • The RFC has complete prose, is well-specified and ready for implementation.
    • All sections of the RFC are filled out.
    • Any unanswered questions are outlined and expected to be answered before Ready for Release.
    • "How we teach this?" is sufficiently filled out.
  • The RFC has a champion within one of the relevant teams.
  • The RFC has consensus after the FCP period.

@github-actions github-actions bot added the S-Proposed In the Proposed Stage label Jan 12, 2025
@ef4
Copy link
Contributor

ef4 commented Jan 17, 2025

Notes from first discussing of this proposal in RFC review:

  • regardless of whether we decide to accept this change, it would be good to replace the tracked storage polyfill with a real implementation first.
  • it does seem implied by the built-in array and hash helper RFCs that tracked implementations of those things would exist at a fairly low level (assuming they get implemented as glimmer keywords, glimmer itself would necessarily know about implementation of TrackedArray and TrackedObject).

@NullVoxPopuli
Copy link
Contributor Author

tracked-storage-primitive in implementation here: emberjs/ember.js#20814

@NullVoxPopuli
Copy link
Contributor Author

related to non-reactive entries for array and hash: #1070 (Array and Object)

@josemarluedke
Copy link

Great work on this RFC! I’d like to propose a utility function, such as reactive, that could create the appropriate tracked data structure based on the input type. This could simplify the process of creating tracked values and make the API more flexible.

For example, if you pass an object to the reactive function, it would return a TrackedObject. If you pass an array, it would return a TrackedArray. This would allow developers to more easily create tracked data structures without needing to manually specify the type each time.

import { reactive } from '@ember/reactive';

const trackedObj = reactive({ key: 'value' }); // returns TrackedObject
const trackedArr = reactive([1, 2, 3]); // returns TrackedArray

Additionally, I’d suggest reconsidering the naming of Tracked*. To better align with the language used in other frameworks and make the terms more intuitive, perhaps these could be renamed to Reactive*. This would emphasize the reactive nature of these structures and help make the API more consistent with other reactive libraries.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-Proposed In the Proposed Stage
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants