Skip to content

Conversation

@matthewhartstonge
Copy link
Contributor

Converts paper-form to a glimmer component.

Breaking Change

The ChildMixin makes a call to a deprecated internal/private Ember.ViewMixin.nearestOfType function to find the parent component (based on the ParentMixin) so that it can magically register the non-contextual component as a child.

As such, the following test now fails, and I have marked as skip:

Integration | Component | paper form: works without using contextual components

To ease migration, we can yield the parent into the hash, in which case it would be up to users to inject the parent into any non-contexual components that accept a parent component as an argument (PaperItem, PaperInput, e.t.c).

I have created a new test which is a copy of the old, but passes in the yielded parent, which uses this pattern and passes:

Integration | Component | paper form: works without using contextual components by binding in the yielded parent

The troublesome mixin code:

// addon/mixins/child-mixin.js

export default Mixin.create({
  // override to look for a specific parent class
  parentClass: ParentMixin,

  // this will typically be overriden when yielding a contextual component
  parentComponent: computed({
    get() {
      if (this._parentComponent !== undefined) {
        return this._parentComponent;
      }

      return this.nearestOfType(this.parentClass);
    },

    set(key, value) {
      return this._parentComponent = value;
    }
  }),

Refer: https://api.emberjs.com/ember/5.12/classes/Ember.ViewMixin/methods/nearestOfType?anchor=nearestOfType&show=inherited,protected,private,deprecated

@matthewhartstonge
Copy link
Contributor Author

matthewhartstonge commented Nov 13, 2024

@mansona have you come across this this type of error before?

Seems to only rear its head on 3.24...
3.20 passes
3.28 passes

I think this could be related to the ValidationMixin so I'm hoping it may come out in the wash as I glimmer~ise the components?

not ok 76 Chrome 130.0 - [35 ms] - Integration | Component | paper form: form `onSubmit` action is invoked when form element is submitted
    ---
        stack: >
            Error: Assertion Failed: You attempted to update `[]` on `<Array:ember710>`, but it had already been used previously in the same computation.  Attempting to update a value after using it in a computation can cause logical errors, infinite revalidation bugs, and performance issues, and is not supported.
            
            `[]` was first used:
            
            - While rendering:
              -top-level
                application
                  index
                    paper-form
                      (result of a `unknown` helper)
                        (result of a `hash` helper).input
                          (result of a `hash` helper)
                            @isValid
                              this.isValid
            
            Stack trace for the update:
                at dirtyTagFor (http://localhost:7357/assets/vendor.js:65788:37)
                at markObjectAsDirty (http://localhost:7357/assets/vendor.js:23931:32)
                at notifyPropertyChange (http://localhost:7357/assets/vendor.js:23969:5)
                at arrayContentDidChange (http://localhost:7357/assets/vendor.js:24079:7)
                at replaceInNativeArray (http://localhost:7357/assets/vendor.js:24144:5)
                at replace (http://localhost:7357/assets/vendor.js:24121:7)
                at insertAt (http://localhost:7357/assets/vendor.js:36010:24)
        message: >
            global failure: Error: Assertion Failed: You attempted to update `[]` on `<Array:ember710>`, but it had already been used previously in the same computation.  Attempting to update a value after using it in a computation can cause logical errors, infinite revalidation bugs, and performance issues, and is not supported.

@matthewhartstonge matthewhartstonge force-pushed the feature/glimmer-paper-grid-tile branch 2 times, most recently from bfa6a27 to 0837a8c Compare November 14, 2024 02:56
@matthewhartstonge matthewhartstonge force-pushed the feature/glimmer-paper-form branch from e1eda8e to 3409186 Compare November 14, 2024 02:56
@matthewhartstonge matthewhartstonge force-pushed the feature/glimmer-paper-grid-tile branch from 0837a8c to 8dea1ea Compare November 15, 2024 02:46
@matthewhartstonge matthewhartstonge force-pushed the feature/glimmer-paper-form branch from 3409186 to d5cce06 Compare November 15, 2024 02:49
@matthewhartstonge matthewhartstonge force-pushed the feature/glimmer-paper-grid-tile branch from 8dea1ea to 05d7c66 Compare November 17, 2024 22:20
@matthewhartstonge matthewhartstonge force-pushed the feature/glimmer-paper-form branch from d5cce06 to 34f1129 Compare November 17, 2024 22:21
@matthewhartstonge matthewhartstonge changed the base branch from feature/glimmer-paper-grid-tile to feature/glimmer-paper-select December 17, 2024 03:30
@matthewhartstonge matthewhartstonge force-pushed the feature/glimmer-paper-form branch from 34f1129 to 1aea46c Compare December 17, 2024 03:30
@matthewhartstonge matthewhartstonge force-pushed the feature/glimmer-paper-select branch from 8444359 to 438503f Compare December 30, 2024 11:11
@matthewhartstonge matthewhartstonge force-pushed the feature/glimmer-paper-form branch from a756216 to d03b8f7 Compare December 30, 2024 11:14
@github-actions
Copy link

github-actions bot commented Dec 30, 2024

Some tests with 'continue-on-error: true' have failed:

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.

Convert all components using ember-composability-tools to glimmer

2 participants