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

Error with ember 3.1 #1094

Closed
Titinux opened this issue Apr 17, 2018 · 14 comments · Fixed by #1097
Closed

Error with ember 3.1 #1094

Titinux opened this issue Apr 17, 2018 · 14 comments · Fixed by #1097

Comments

@Titinux
Copy link

Titinux commented Apr 17, 2018

Hi, I recently updated ember to version 3.1 and now ember-power-select is not working if I use the selected option.

{{#power-select options=layouts
    selected=selectedLayout
    onchange=(action (mut selectedLayout)) as |layout|}}
  {{layout.name}}
{{/power-select}}

layouts is the result of

this.get('store').findAll('layout')

The error message is

Error: Assertion Failed: You attempted to access the `then` property (of <(unknown mixin):ember757>).
Since Ember 3.1, this is usually fine as you no longer need to use `.get()`
to access computed properties. However, in this case, the object in question
is a special kind of Ember object (a proxy). Therefore, it is still necessary
to use `.get('then')` in this case.

If you encountered this error because of third-party code that you don't control,
there is more information at https://github.com/emberjs/ember.js/issues/16148, and
you can help us improve this error message by telling us more about what happened in
this situation.

it seems to come from this line

if (selected && selected.then) {

@cibernox
Copy link
Owner

Yeah, someone reported it in emberjs/ember.js#16148 (comment) but I don't have a clear understanding of what the fix is. I'll try to allocate some time to investigate it, but if you have time by all means, go for it.

donaldwasserman added a commit to donaldwasserman/ember-power-select that referenced this issue Apr 19, 2018
@donaldwasserman
Copy link
Contributor

@cibernox @Titinux - I submitted a PR. As I explain in the #1097, I don't know if it's the most elegant, but at least it works.

cibernox pushed a commit that referenced this issue Apr 19, 2018
@cibernox
Copy link
Owner

Released in 2.0.0-beta.4

@huberts
Copy link

huberts commented Apr 20, 2018

I tried to pindown this bug, but I have no working (simple) example. I have spotted this in my application, but it was so deep down nested it could not work as a snippet. I will take the beta.4 version and check it. Thanks!

@andrewtimberlake
Copy link

This is still a problem with [email protected]
If I remove the selected= the error goes away.

It happens after the above mentioned if(selected && selected.then), which is changed.
It happens within the call to this.get('_updateSelectedTask').perform(selected);

Error:

Error: Assertion Failed: You attempted to access the `then` property (of <(unknown mixin):ember1188>).
Since Ember 3.1, this is usually fine as you no longer need to use `.get()`
to access computed properties. However, in this case, the object in question
is a special kind of Ember object (a proxy). Therefore, it is still necessary
to use `.get('then')` in this case.

@cibernox
Copy link
Owner

If you're in the latest version it means you still have an old version of ember-concurrency installed. Can you update EC and see how it goes?

@andrewtimberlake
Copy link

Updated, still an error with [email protected]

@donaldwasserman
Copy link
Contributor

donaldwasserman commented May 21, 2018

I use this all over the place in two different apps and don't really see this error. Is it on Ember 3.1 or 3.2?

@andrewtimberlake Can you copy and paste and example of your usage? Are you using the EC-powered search? e\Also, I noticed a similar problem before with conflicting versions between EC in my host app and EC required by power select where my app wasn't using the latest version of EC.

@cibernox Looking through the code, there's a handful of more usages of if (<Task>.then). Would it be good to just switch them all over to use get(<thing>, 'then')?

@cibernox
Copy link
Owner

What would help. Perhaps that's the problem and it just happens that I haven't exercised that code.

@andrewtimberlake
Copy link

andrewtimberlake commented May 21, 2018

I don’t know if this helps diagnose the problem, my selected is an object from a DS.belongsTo()
1__andrew_andrews-imac_local____dev_debtflow_webapp__node_
tst1_debtflow_test_4200_users

@cibernox
Copy link
Owner

Just in case I release a new version in which I which I replaced if (obj.then) by if (get(obj, 'then'). Check if that helps.

@andrewtimberlake
Copy link

@cibernox, That didn’t change things.

I have put up a test repo that reproduces a similar issue. I am running my model through Ember Changeset which seems to be the cause of the problem. I don’t know if the problem is with Ember Changeset or with the fact that EC returns a proxy object.
The repo is at https://github.com/andrewtimberlake/ember-power-select-test-1094

@donaldwasserman
Copy link
Contributor

I think it's because the relationship returns as DS.PromiseObject can you try making the relationship DS.BelongsTo('user', {async: false}) and then make sure the record is loaded into the store?

@andrewtimberlake
Copy link

Thanks everyone for the help.
{async: false} and preloading was the answer

kswilster added a commit to salsify/ember-power-select that referenced this issue Oct 1, 2018
* Resolves typo. (cibernox#1055)

* Added another addon: https://github.com/IliasDeros/ember-data-power-select

* v2.0.0-beta.1

* Fix but by bumping minimum version of ember-basic-dropdown

* selectedItemComponent into beforeOptionsComponent (cibernox#1060)

Make `selectedItemComponent` available in `beforeOptionsComponent`. This will allow for a persistent header showing the overall selected items inside of `power-select-multiple`. This matters in the case where the list ends up scrolling.

* v2.0.0-beta.2

* Fix sandboxing

* Add extra params for trigger (cibernox#1062)

* Add factoryFor in 2.10 ember-try scenario (cibernox#1063)

* Improve test-helpers import path (cibernox#1067)

* Improve test-helpers import path

* Still use ember-native-dom-helpers for find and findAll

* Document new import path

* v2.0.0-beta.3

* Fix bad code sample

* `horizontalPosition` property api reference update (cibernox#1071)

* Update how-to-use-it.hbs (cibernox#1080)

typo

* Update installation.hbs (cibernox#1078)

small typo

* Update installation.hbs (cibernox#1079)

this might be a typo as well

* Update action-handling.hbs (cibernox#1081)

Sorry to submit several PRs. I create them as I encounter typos.
I tried compile only one for action-handling.hbs this time tough ;-)

* stop click propagation added to the docs (cibernox#1087)

* stop click propagation added to the docs

* added more info about stop click propagation in the docs

* Update addon to 3.1 (cibernox#1088)

* Update addon to 3.1

* Smarter way to decide wether or not we want to load jquery

* Modernize test suite part 1 (cibernox#1089)

* Modernize test suite part 2 (cibernox#1090)

* Modernize test suite part 3 (cibernox#1091)

* Modernize test suite part 4 (cibernox#1092)

* Modernize test suite part 5 (cibernox#1093)

* Remove more usages of ember-native-dom-helpers

* Add more qunit-dom

* fixes cibernox#1094 (cibernox#1097)

* qunit-dom is almost everywhere (cibernox#1096)

* v2.0.0-beta.4

* Simplify tests a bit more

* Penultimate test refactor (cibernox#1098)

* Remove all traces of find/findAll from ember-native-dom-helpers

* Changed self.window to window and self.document to document (cibernox#1099)

* v2.0.0-beta.5

* Pre-render docs site at build time (cibernox#1102)

This PR enables Fastboot pre-rendering of the entire docs site using [prember[(https://github.com/ef4/prember). For URL discovery, it's using the newly-published [prember-crawler](https://github.com/ef4/prember-crawler)

I tested the `_redirects` on netlify to confirm it will work, and it does. By default, prember outputs an `_empty.html` file that contains your original (empty) index.html content, since your pre-rendered index.html file will have actual content in it.

* Making helpers more async (cibernox#1100)

* Fix last set of tests

* Add two more tests

* Improve component's behavior in beta (cibernox#1104)

* Fix typo

* Remove native dom helpers (cibernox#1105)

* Remove dependency on ember-native-dom-helpers

* Not used any more

* Update changelog

* v2.0.0

* Update ember-concurrency to fix bug in beta and canary (cibernox#1106)

* Drop node 4

* Add extra params for `selectedItemComponent` on trigger (power-select-multiple) (cibernox#1111)

* Fix: add extra hash to power-select-multiple selectedItemComponent

* Test: Add a couple missing tests for power-select-multiple with custom components

* Test: Update to use new `qunit-dom` test syntax

* v2.0.1

* Remove direct access to then (cibernox#1116)

* v2.0.2

* Remove console-log from test helper (cibernox#1119)

* typo (cibernox#1118)

* Remove console.log from test support (cibernox#1108)

* v2.0.3

* Bind title to the trigger (cibernox#1126)

* Fix tests failing due to new assertion in triggerKeyEvent (cibernox#1129)

* Replaced return value of maybePlaceholder for IE to undefined (cibernox#1128)

* v2.0.4

* Update to ember-cli 3.2 (cibernox#1132)

* Update to 3.3 (cibernox#1137)

* 2.X is not in beta

* guard against destroying hook when calling deactivate (cibernox#1144)

* 2.0.5

* Update to ember-cli 3.4 (cibernox#1149)

* Update to ember-cli 3.4

* Fix template-lint errors

* Update ember-data to 3.4 (cibernox#1150)

* Test and possible fix for cibernox#1147 (cibernox#1151)

* v2.0.6

* Only load polyfill when not in FastBoot environment (cibernox#1155)

fixes cibernox#1154

* v2.0.7

* v2.0.7

* fix: typeof returns string, broke polyfill when necessary (cibernox#1157)

* v2.0.8

* etc

* fixing tests

* circle node version

* migrate to circle 2
kswilster added a commit to salsify/ember-power-select that referenced this issue Jan 3, 2019
* Resolves typo. (cibernox#1055)

* Added another addon: https://github.com/IliasDeros/ember-data-power-select

* v2.0.0-beta.1

* Fix but by bumping minimum version of ember-basic-dropdown

* selectedItemComponent into beforeOptionsComponent (cibernox#1060)

Make `selectedItemComponent` available in `beforeOptionsComponent`. This will allow for a persistent header showing the overall selected items inside of `power-select-multiple`. This matters in the case where the list ends up scrolling.

* v2.0.0-beta.2

* Fix sandboxing

* Add extra params for trigger (cibernox#1062)

* Add factoryFor in 2.10 ember-try scenario (cibernox#1063)

* Improve test-helpers import path (cibernox#1067)

* Improve test-helpers import path

* Still use ember-native-dom-helpers for find and findAll

* Document new import path

* v2.0.0-beta.3

* Fix bad code sample

* `horizontalPosition` property api reference update (cibernox#1071)

* Update how-to-use-it.hbs (cibernox#1080)

typo

* Update installation.hbs (cibernox#1078)

small typo

* Update installation.hbs (cibernox#1079)

this might be a typo as well

* Update action-handling.hbs (cibernox#1081)

Sorry to submit several PRs. I create them as I encounter typos.
I tried compile only one for action-handling.hbs this time tough ;-)

* stop click propagation added to the docs (cibernox#1087)

* stop click propagation added to the docs

* added more info about stop click propagation in the docs

* Update addon to 3.1 (cibernox#1088)

* Update addon to 3.1

* Smarter way to decide wether or not we want to load jquery

* Modernize test suite part 1 (cibernox#1089)

* Modernize test suite part 2 (cibernox#1090)

* Modernize test suite part 3 (cibernox#1091)

* Modernize test suite part 4 (cibernox#1092)

* Modernize test suite part 5 (cibernox#1093)

* Remove more usages of ember-native-dom-helpers

* Add more qunit-dom

* fixes cibernox#1094 (cibernox#1097)

* qunit-dom is almost everywhere (cibernox#1096)

* v2.0.0-beta.4

* Simplify tests a bit more

* Penultimate test refactor (cibernox#1098)

* Remove all traces of find/findAll from ember-native-dom-helpers

* Changed self.window to window and self.document to document (cibernox#1099)

* v2.0.0-beta.5

* Pre-render docs site at build time (cibernox#1102)

This PR enables Fastboot pre-rendering of the entire docs site using [prember[(https://github.com/ef4/prember). For URL discovery, it's using the newly-published [prember-crawler](https://github.com/ef4/prember-crawler)

I tested the `_redirects` on netlify to confirm it will work, and it does. By default, prember outputs an `_empty.html` file that contains your original (empty) index.html content, since your pre-rendered index.html file will have actual content in it.

* Making helpers more async (cibernox#1100)

* Fix last set of tests

* Add two more tests

* Improve component's behavior in beta (cibernox#1104)

* Fix typo

* Remove native dom helpers (cibernox#1105)

* Remove dependency on ember-native-dom-helpers

* Not used any more

* Update changelog

* v2.0.0

* Update ember-concurrency to fix bug in beta and canary (cibernox#1106)

* Drop node 4

* Add extra params for `selectedItemComponent` on trigger (power-select-multiple) (cibernox#1111)

* Fix: add extra hash to power-select-multiple selectedItemComponent

* Test: Add a couple missing tests for power-select-multiple with custom components

* Test: Update to use new `qunit-dom` test syntax

* v2.0.1

* Remove direct access to then (cibernox#1116)

* v2.0.2

* Remove console-log from test helper (cibernox#1119)

* typo (cibernox#1118)

* Remove console.log from test support (cibernox#1108)

* v2.0.3

* Bind title to the trigger (cibernox#1126)

* Fix tests failing due to new assertion in triggerKeyEvent (cibernox#1129)

* Replaced return value of maybePlaceholder for IE to undefined (cibernox#1128)

* v2.0.4

* Update to ember-cli 3.2 (cibernox#1132)

* Update to 3.3 (cibernox#1137)

* 2.X is not in beta

* guard against destroying hook when calling deactivate (cibernox#1144)

* 2.0.5

* Update to ember-cli 3.4 (cibernox#1149)

* Update to ember-cli 3.4

* Fix template-lint errors

* Update ember-data to 3.4 (cibernox#1150)

* Test and possible fix for cibernox#1147 (cibernox#1151)

* v2.0.6

* Only load polyfill when not in FastBoot environment (cibernox#1155)

fixes cibernox#1154

* v2.0.7

* v2.0.7

* fix: typeof returns string, broke polyfill when necessary (cibernox#1157)

* v2.0.8

* Fix typo in api-reference.hbs (cibernox#1158)

* use .set() to avoid assertion failure under Ember 3.4 (cibernox#1162)

* Add animationEnabled to be passed down to ember-basic-dropdown (cibernox#1165)

* Add highlightOnHoverEnabled to be used in options.js (cibernox#1166)

* Add highlightOnHoverEnabled to be used in options.js

When false, will disable automatically highlighting an option
when hovered over with the mouse. This will prevent unintentionally
selecting a new value when tabbing through a form with an EPS field
while the user's mouse is where the list will appear when the EPS
gains and then looses focus.

* Renamed highlightOnHoverEnabled to highlightOnHover

* v2.0.9

* Change slack for discord (cibernox#1169)

* close -> clone (cibernox#1176)

* close -> clone

'clone' is the intended word in the context, and the spelling error 'close' may cause some confusion to the reader

* spelling error fixes

close -> clone
debounding -> debouncing

just two small mistakes, can be confusing in context for the reader

* Fix build error (cibernox#1178)

* User active-voice instead of passive-voice

* Document using a computed property for the selected property

* Fix build error due to missing rel='noopener'

* Improve documentation (cibernox#1177)

* User active-voice instead of passive-voice

* Document using a computed property for the selected property

* Fix build error due to missing rel='noopener'

* minor typos

* Changed npm and bower for yarn

Changed instructions for contributing from `npm install` and `bower install` to `yarn install` as per cibernox#1179 to reflect updated build tools.

* Fix typo

* Allow select to open with click (cibernox#1181)

* v2.0.10

* v2.0.11

* Fix inconsistent focus of the input in single selects (cibernox#1180)

* v2.0.12

* v2.0.13

* v2.0.14

* v2.0.15

* Fix npm audit warnings (1 critical, 2 high) (cibernox#1183)

* Allow direct imports from node_modules (cibernox#1182)

* v2.1.0

* v2.2.0 (cibernox#1185)

* [BUGFIX] Allow test helpers to work with EBD >=1.0.5 (cibernox#1190)

In EBD 1.0.5 a fix for better a11y was introduced. It makes aria-owns to only be present on the trigger when
the dropdown is open. Test helpers in EPS relied in that property being there all the time, but now
they work both ways.

* v2.2.1

* Specify that only strings are searchable

* Update all dependencies December 2018 (cibernox#1194)

* Update all dependencies December 2018

* Fix sass complaint

* Fix tests

* Replace ember-cli-eslint with plain eslint (cibernox#1195)

* "You attempted to access the `length` property (of <(unknown):ember712>). (cibernox#1148)

Since Ember 3.1, this is usually fine as you no longer need to use `.get()`
to access computed properties. However, in this case, the object in question
is a special kind of Ember object (a proxy). Therefore, it is still necessary
to use `.get('length')` in this case.

If you encountered this error because of third-party code that you don't control,
there is more information at emberjs/ember.js#16148, and
you can help us improve this error message by telling us more about what happened in
this situation."
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 a pull request may close this issue.

5 participants