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

Use Glimmer.js version of UpdatableReference to avoid action volatility #95

Merged
merged 1 commit into from
Dec 7, 2017

Conversation

tomdale
Copy link
Contributor

@tomdale tomdale commented Dec 7, 2017

The UpdatableReference provided by @glimmer/object-reference is volatile, and we were inadvertently using it to wrap values produced by the {{action}} helper.

This commit uses the version of UpdatableReference from @glimmer/component, which is stable until its underlying value is manually updated. This avoids significant performance degradation when values from {{action}} helpers are passed as args into other components.

The UpdatableReference provided by @glimmer/object-reference is volatile, and we were inadverently using it to wrap values produced by the {{action}} helper.

This commit uses the version of UpdatableReference from @glimmer/component, which is stable until its underlying value is manually updated. This avoids significant performance degradation when values from {{action}} helpers are passed as args into other components.
@@ -1,4 +1,4 @@
import { UpdatableReference } from "@glimmer/object-reference";
Copy link
Member

Choose a reason for hiding this comment

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

Oiy. How many times have we been bitten by this same thing? Any chance of making @glimmer/object-reference a private package that doesn’t get published (while we fix glimmer-vm’s test suite to not rely on it)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rwjblue Yeah, seriously. There is one usage of it left in Glimmer.js, actually, that was not as simple to fix as this one because the circular dependency breaks initialization.

We could fix that in the interim by hoisting the references stuff in @glimmer/component into a separate package (@glimmer/component-reference?), but I think the real solution is to hoist the reference implementation up into glimmer-vm so that it can be shared by both Glimmer.js and Ember.js (we'll need this imminently for interop between the two, anyway).

I know @krisselden had some ideas for a strawman API for creating composable references from multiple environments. I'd like to understand the level of effort for that to decide if we should do something temporary to fix this, or just bite the bullet and build the composable system we'll need soon anyway.

@chadhietala
Copy link
Member

Copy link
Member

@chadhietala chadhietala left a comment

Choose a reason for hiding this comment

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

I opened up #96 to address the volatile helpers.

@chadhietala chadhietala merged commit cecf339 into master Dec 7, 2017
@chadhietala chadhietala deleted the stable-action-tag branch December 7, 2017 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants