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

fix(metrics service): replace object iterator with Object.values #374

Merged

Conversation

gilest
Copy link
Contributor

@gilest gilest commented Nov 21, 2021

Looks like the _adapters = {}; doesn't support native iteration since it's a plain object.

From MDN:

In JavaScript, Objects are not iterable unless they implement the iterable protocol. Therefore, you cannot use for…of to iterate over the properties of an object.

Fixes #373

Lifecycle test

I've added a very basic acceptance test – which fails before this patch is applied. I think it can be helpful to catch lifecycle bugs like this in the future. Happy to split into a separate PR if necessary.

@gilest gilest changed the title fix(metrics service): replace object iterator with Object.entries fix(metrics service): replace object iterator with Object.entries Nov 21, 2021
@gilest gilest force-pushed the fix/not-iterable-will-destroy branch from 8f28d35 to bb3e800 Compare November 22, 2021 00:55
@gilest gilest changed the title fix(metrics service): replace object iterator with Object.entries fix(metrics service): replace object iterator with Object.values Nov 22, 2021
Copy link
Contributor

@jherdman jherdman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oof... That test is embarrassingly simple 😆

@jherdman jherdman merged commit 8fb9e4f into adopted-ember-addons:master Nov 22, 2021
@gilest gilest deleted the fix/not-iterable-will-destroy branch March 6, 2022 22:13
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.

this._adapters is not iterable in willDestory hook
2 participants