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

[BUGFIX release] Revert lazy hash changes #19594

Merged
merged 3 commits into from Jun 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 13 additions & 13 deletions package.json
Expand Up @@ -51,7 +51,7 @@
"@babel/plugin-transform-block-scoping": "^7.8.3",
"@babel/plugin-transform-object-assign": "^7.8.3",
"@ember/edition-utils": "^1.2.0",
"@glimmer/vm-babel-plugins": "0.79.3",
"@glimmer/vm-babel-plugins": "0.78.2",
"babel-plugin-debug-macros": "^0.3.3",
"babel-plugin-filter-imports": "^4.0.0",
"broccoli-concat": "^4.2.4",
Expand All @@ -76,19 +76,19 @@
},
"devDependencies": {
"@babel/preset-env": "^7.9.5",
"@glimmer/compiler": "0.79.3",
"@glimmer/destroyable": "0.79.3",
"@glimmer/compiler": "0.78.2",
"@glimmer/destroyable": "0.78.2",
"@glimmer/env": "^0.1.7",
"@glimmer/global-context": "0.79.3",
"@glimmer/interfaces": "0.79.3",
"@glimmer/manager": "0.79.3",
"@glimmer/node": "0.79.3",
"@glimmer/opcode-compiler": "0.79.3",
"@glimmer/owner": "0.79.3",
"@glimmer/program": "0.79.3",
"@glimmer/reference": "0.79.3",
"@glimmer/runtime": "0.79.3",
"@glimmer/validator": "0.79.3",
"@glimmer/global-context": "0.78.2",
"@glimmer/interfaces": "0.78.2",
"@glimmer/manager": "0.78.2",
"@glimmer/node": "0.78.2",
"@glimmer/opcode-compiler": "0.78.2",
"@glimmer/owner": "0.78.2",
"@glimmer/program": "0.78.2",
"@glimmer/reference": "0.78.2",
"@glimmer/runtime": "0.78.2",
"@glimmer/validator": "0.78.2",
"@simple-dom/document": "^1.4.0",
"@types/qunit": "^2.9.1",
"@types/rsvp": "^4.0.3",
Expand Down
8 changes: 0 additions & 8 deletions packages/@ember/-internals/glimmer/lib/environment.ts
Expand Up @@ -125,14 +125,6 @@ const VM_DEPRECATION_OVERRIDES: (DeprecationOptions & {
enabled: '3.27.0',
},
},
{
id: 'setting-on-hash',
until: '4.4.0',
for: 'ember-source',
since: {
enabled: '3.28.0',
},
},
];

const VM_ASSERTION_OVERRIDES: { id: string; message: string }[] = [];
Expand Down
21 changes: 1 addition & 20 deletions packages/@ember/-internals/glimmer/lib/syntax/outlet.ts
Expand Up @@ -98,26 +98,7 @@ export const outletHelper = internalHelper(

if (state !== null) {
let named = dict<Reference>();

// Create a ref for the model
let modelRef = childRefFromParts(outletRef, ['render', 'model']);

// Store the value of the model
let model = valueForRef(modelRef);

// Create a compute ref which we pass in as the `{{@model}}` reference
// for the outlet. This ref will update and return the value of the
// model _until_ the outlet itself changes. Once the outlet changes,
// dynamic scope also changes, and so the original model ref would not
// provide the correct updated value. So we stop updating and return
// the _last_ model value for that outlet.
named.model = createComputeRef(() => {
if (lastState === state) {
model = valueForRef(modelRef);
}

return model;
});
named.model = childRefFromParts(outletRef, ['render', 'model']);

if (DEBUG) {
named.model = createDebugAliasRef!('@model', named.model);
Expand Down
Expand Up @@ -2,8 +2,7 @@ import { RenderingTestCase, moduleFor, runTask } from 'internal-test-helpers';

import { Component } from '../../utils/helpers';

import { set, computed } from '@ember/-internals/metal';
import { HAS_NATIVE_PROXY } from '@ember/-internals/utils';
import { set } from '@ember/-internals/metal';

moduleFor(
'Helpers test: {{hash}}',
Expand Down Expand Up @@ -187,132 +186,5 @@ moduleFor(

this.assertText('Chad Hietala');
}

['@test works with computeds']() {
let FooBarComponent = Component.extend({
fullName: computed('hash.firstName', 'hash.lastName', function () {
return `${this.hash.firstName} ${this.hash.lastName}`;
}),
});

this.registerComponent('foo-bar', {
ComponentClass: FooBarComponent,
template: `{{this.fullName}}`,
});

this.render(`{{foo-bar hash=(hash firstName=this.firstName lastName=this.lastName)}}`, {
firstName: 'Chad',
lastName: 'Hietala',
});

this.assertText('Chad Hietala');

runTask(() => this.rerender());

this.assertText('Chad Hietala');

runTask(() => {
set(this.context, 'firstName', 'Godfrey');
set(this.context, 'lastName', 'Chan');
});

this.assertText('Godfrey Chan');
}

['@test works with computeds on non-defined properties']() {
let instance;

let FooBarComponent = Component.extend({
init() {
this._super(...arguments);

if (HAS_NATIVE_PROXY) {
expectDeprecation(() => {
set(this.hash, 'lastName', 'Hietala');
}, /You set the '.*' property on a {{hash}} object/);
} else {
set(this.hash, 'lastName', 'Hietala');
}

instance = this;
},

fullName: computed('hash.firstName', 'hash.lastName', function () {
return `${this.hash.firstName} ${this.hash.lastName}`;
}),
});

this.registerComponent('foo-bar', {
ComponentClass: FooBarComponent,
template: `{{this.fullName}}`,
});

this.render(`{{foo-bar hash=(hash firstName=this.firstName)}}`, {
firstName: 'Chad',
lastName: 'Hietala',
});

this.assertText('Chad Hietala');

runTask(() => this.rerender());

this.assertText('Chad Hietala');

runTask(() => {
set(this.context, 'firstName', 'Godfrey');

if (HAS_NATIVE_PROXY) {
expectDeprecation(() => {
set(instance.hash, 'lastName', 'Chan');
}, /You set the '.*' property on a {{hash}} object/);
} else {
set(instance.hash, 'lastName', 'Chan');
}
});

this.assertText('Godfrey Chan');
}

['@test works when properties are set dynamically']() {
let fooBarInstance;
let FooBarComponent = Component.extend({
init() {
this._super();
fooBarInstance = this;
},
});

this.registerComponent('foo-bar', {
ComponentClass: FooBarComponent,
template: `{{this.hash.firstName}} {{this.hash.lastName}}`,
});

this.render(`{{foo-bar hash=(hash firstName=this.firstName)}}`, {
firstName: 'Chad',
});

this.assertText('Chad ');

runTask(() => {
if (HAS_NATIVE_PROXY) {
expectDeprecation(() => {
set(fooBarInstance.hash, 'lastName', 'Hietala');
}, /You set the '.*' property on a {{hash}} object/);
} else {
set(fooBarInstance.hash, 'lastName', 'Hietala');
}
});

this.assertText('Chad Hietala');

runTask(() => {
expectDeprecation(() => {
set(fooBarInstance.hash, 'firstName', 'Godfrey');
set(fooBarInstance.hash, 'lastName', 'Chan');
}, /You set the '.*' property on a {{hash}} object/);
});

this.assertText('Godfrey Chan');
}
}
);