Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -389,4 +389,4 @@
}
},
"packageManager": "[email protected]"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ import {

import ComponentStateBucket from '../utils/curly-component-state-bucket';
import { processComponentArgs } from '../utils/process-args';
import { setProperties } from '@ember/-internals/metal';

export const ARGS = enumerableSymbol('ARGS');
export const HAS_BLOCK = enumerableSymbol('HAS_BLOCK');
Expand Down Expand Up @@ -440,7 +441,7 @@ export default class CurlyComponentManager
bucket.argsRevision = valueForTag(argsTag);

component[IS_DISPATCHING_ATTRS] = true;
component.setProperties(props);
setProperties(component, props);
component[IS_DISPATCHING_ATTRS] = false;

component.trigger('didUpdateAttrs');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { InternalOwner } from '@ember/-internals/owner';
import { generateControllerFactory } from '@ember/routing/-internals';
import { assert } from '@ember/debug';
import EngineInstance from '@ember/engine/instance';
import { get, set } from '@ember/object';
import { associateDestroyableChild } from '@glimmer/destroyable';
import type {
CapturedArguments,
Expand Down Expand Up @@ -95,7 +96,7 @@ class MountManager
let modelRef;

if (args.named.has('model')) {
modelRef = args.named.get('model');
modelRef = get(args.named, 'model') as Reference;
}

if (modelRef === undefined) {
Expand Down Expand Up @@ -163,7 +164,7 @@ class MountManager
let { controller, modelRef } = bucket;

if (modelRef !== undefined) {
controller.set('model', valueForRef(modelRef));
set(controller, 'model', valueForRef(modelRef));
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions packages/@ember/-internals/glimmer/lib/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,12 +268,12 @@ declare const SIGNATURE: unique symbol;

```app/components/my-widget.js
import Component from '@ember/component';
import EmberObject from '@ember/object';
import CoreObject from '@ember/object/core';

export default class extends Component {
classNameBindings = ['messages.empty'];

messages = EmberObject.create({
messages = CoreObject.create({
empty: true
});
}
Expand Down Expand Up @@ -867,7 +867,7 @@ class Component<S = unknown>

getAttr(key: string) {
// TODO Intimate API should be deprecated
return this.get(key);
return get(this, key);
}

/**
Expand Down
1 change: 1 addition & 0 deletions packages/@ember/-internals/glimmer/lib/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ export default class Helper<S = unknown> extends FrameworkObject {
assert('expected compute to be defined', this.compute);
}

// TODO: Update example to not use observer
/**
On a class-based helper, it may be useful to force a recomputation of that
helpers value. This is akin to `rerender` on a component.
Expand Down
2 changes: 1 addition & 1 deletion packages/@ember/-internals/glimmer/lib/helpers/mut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { internalHelper } from './internal-helper';
// my-child.js
export default class MyChild extends Component {
click() {
this.incrementProperty('childClickCount');
set(this, 'childClickCount', this.childClickCount + 1);
}
}
```
Expand Down
4 changes: 2 additions & 2 deletions packages/@ember/-internals/glimmer/lib/helpers/readonly.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import { internalHelper } from './internal-helper';
```app/components/my-child.js
export default class MyChild extends Component {
click() {
this.incrementProperty('childClickCount');
set(this, 'childClickCount', this.childClickCount + 1);
}
}
```
Expand Down Expand Up @@ -95,7 +95,7 @@ import { internalHelper } from './internal-helper';

export default class MyChild extends Component {
click() {
this.get('clicks').incrementProperty('total');
set(this.clicks, 'total', this.clicks.total + 1);
}
}
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
import { ENV } from '@ember/-internals/environment';
import { Component, setComponentManager } from '@ember/-internals/glimmer';
import type { InternalOwner } from '@ember/-internals/owner';
import { set } from '@ember/object';
import Route from '@ember/routing/route';
import Controller from '@ember/controller';
import { assert, captureRenderTree } from '@ember/debug';
Expand Down Expand Up @@ -313,7 +314,8 @@ if (ENV._DEBUG_RENDER_TREE) {
]);

runTask(() => {
this.controllerFor('application')!.set('engineName', 'bar');
const controller = this.controllerFor('application')!;
set(controller, 'engineName', 'bar');
});

this.assertRenderTree([
Expand Down Expand Up @@ -362,7 +364,8 @@ if (ENV._DEBUG_RENDER_TREE) {
]);

runTask(() => {
this.controllerFor('application')!.set('engineName', undefined);
const controller = this.controllerFor('application')!;
set(controller, 'engineName', undefined);
});

this.assertRenderTree([
Expand Down Expand Up @@ -396,10 +399,9 @@ if (ENV._DEBUG_RENDER_TREE) {
};

runTask(() => {
this.controllerFor('application')!.setProperties({
showMore: true,
engineModel: model,
});
const controller = this.controllerFor('application')!;
set(controller, 'showMore', true);
set(controller, 'engineModel', model);
});

this.assertRenderTree([
Expand Down Expand Up @@ -458,7 +460,8 @@ if (ENV._DEBUG_RENDER_TREE) {
]);

runTask(() => {
this.controllerFor('application')!.set('engineName', 'bar');
const controller = this.controllerFor('application')!;
set(controller, 'engineName', 'bar');
});

this.assertRenderTree([
Expand Down Expand Up @@ -569,10 +572,9 @@ if (ENV._DEBUG_RENDER_TREE) {
]);

runTask(() => {
this.controllerFor('application')!.setProperties({
showMore: false,
engineName: undefined,
});
const controller = this.controllerFor('application')!;
set(controller, 'showMore', false);
set(controller, 'engineName', undefined);
});

this.assertRenderTree([
Expand Down Expand Up @@ -720,7 +722,7 @@ if (ENV._DEBUG_RENDER_TREE) {
runTask(() => {
let controller = instance!.lookup('controller:application');
assert('Expected an instance of controller', controller instanceof Controller);
controller.set('message', 'World');
set(controller, 'message', 'World');
});

this.assertRenderTree([
Expand Down Expand Up @@ -776,7 +778,7 @@ if (ENV._DEBUG_RENDER_TREE) {
runTask(() => {
let controller = instance!.lookup('controller:application');
assert('Expected an instance of controller', controller instanceof Controller);
controller.set('message', undefined);
set(controller, 'message', undefined);
});

this.assertRenderTree([
Expand Down Expand Up @@ -870,7 +872,8 @@ if (ENV._DEBUG_RENDER_TREE) {
]);

runTask(() => {
this.controllerFor('application')!.set('showSecond', true);
const controller = this.controllerFor('application')!;
set(controller, 'showSecond', true);
});

this.assertRenderTree([
Expand All @@ -895,7 +898,8 @@ if (ENV._DEBUG_RENDER_TREE) {
]);

runTask(() => {
this.controllerFor('application')!.set('showSecond', false);
const controller = this.controllerFor('application')!;
set(controller, 'showSecond', false);
});

this.assertRenderTree([
Expand Down Expand Up @@ -943,7 +947,8 @@ if (ENV._DEBUG_RENDER_TREE) {
]);

runTask(() => {
this.controllerFor('application')!.set('showSecond', true);
const controller = this.controllerFor('application')!;
set(controller, 'showSecond', true);
});

this.assertRenderTree([
Expand All @@ -968,7 +973,8 @@ if (ENV._DEBUG_RENDER_TREE) {
]);

runTask(() => {
this.controllerFor('application')!.set('showSecond', false);
const controller = this.controllerFor('application')!;
set(controller, 'showSecond', false);
});

this.assertRenderTree([
Expand Down Expand Up @@ -1018,7 +1024,8 @@ if (ENV._DEBUG_RENDER_TREE) {
]);

runTask(() => {
this.controllerFor('application')!.set('showSecond', true);
const controller = this.controllerFor('application')!;
set(controller, 'showSecond', true);
});

this.assertRenderTree([
Expand All @@ -1043,7 +1050,8 @@ if (ENV._DEBUG_RENDER_TREE) {
]);

runTask(() => {
this.controllerFor('application')!.set('showSecond', false);
const controller = this.controllerFor('application')!;
set(controller, 'showSecond', false);
});

this.assertRenderTree([
Expand Down Expand Up @@ -1091,7 +1099,8 @@ if (ENV._DEBUG_RENDER_TREE) {
]);

runTask(() => {
this.controllerFor('application')!.set('showSecond', true);
const controller = this.controllerFor('application')!;
set(controller, 'showSecond', true);
});

this.assertRenderTree([
Expand All @@ -1116,7 +1125,8 @@ if (ENV._DEBUG_RENDER_TREE) {
]);

runTask(() => {
this.controllerFor('application')!.set('showSecond', false);
const controller = this.controllerFor('application')!;
set(controller, 'showSecond', false);
});

this.assertRenderTree([
Expand Down Expand Up @@ -1176,7 +1186,8 @@ if (ENV._DEBUG_RENDER_TREE) {
]);

runTask(() => {
this.controllerFor('application')!.set('showSecond', true);
const controller = this.controllerFor('application')!;
set(controller, 'showSecond', true);
});

this.assertRenderTree([
Expand All @@ -1201,7 +1212,8 @@ if (ENV._DEBUG_RENDER_TREE) {
]);

runTask(() => {
this.controllerFor('application')!.set('showSecond', false);
const controller = this.controllerFor('application')!;
set(controller, 'showSecond', false);
});

this.assertRenderTree([
Expand Down Expand Up @@ -1295,7 +1307,7 @@ if (ENV._DEBUG_RENDER_TREE) {
},
]);

runTask(() => target.set('showSecond', true));
runTask(() => set(target, 'showSecond', true));

const secondModifiers: ExpectedRenderNode['children'] = [
{
Expand Down Expand Up @@ -1366,7 +1378,7 @@ if (ENV._DEBUG_RENDER_TREE) {
},
]);

runTask(() => target.set('showSecond', false));
runTask(() => set(target, 'showSecond', false));

this.assertRenderTree([
{
Expand Down Expand Up @@ -1462,7 +1474,8 @@ if (ENV._DEBUG_RENDER_TREE) {
this.assertRenderTree([textareaNode('first', this.element!.firstChild, firstModifiers)]);

runTask(() => {
this.controllerFor('application')!.set('showSecond', true);
const controller = this.controllerFor('application')!;
set(controller, 'showSecond', true);
});

const secondModifiers: ExpectedRenderNode['children'] = [
Expand Down Expand Up @@ -1519,7 +1532,8 @@ if (ENV._DEBUG_RENDER_TREE) {
]);

runTask(() => {
this.controllerFor('application')!.set('showSecond', false);
const controller = this.controllerFor('application')!;
set(controller, 'showSecond', false);
});

this.assertRenderTree([textareaNode('first', this.element!.firstChild, firstModifiers)]);
Expand Down Expand Up @@ -1571,7 +1585,8 @@ if (ENV._DEBUG_RENDER_TREE) {
]);

runTask(() => {
this.controllerFor('application')!.set('showSecond', true);
const controller = this.controllerFor('application')!;
set(controller, 'showSecond', true);
});

const secondModifiers: ExpectedRenderNode['children'] = [
Expand Down Expand Up @@ -1608,7 +1623,8 @@ if (ENV._DEBUG_RENDER_TREE) {
]);

runTask(() => {
this.controllerFor('application')!.set('showSecond', false);
const controller = this.controllerFor('application')!;
set(controller, 'showSecond', false);
});

this.assertRenderTree([
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { moduleFor, ApplicationTestCase } from 'internal-test-helpers';
import Controller from '@ember/controller';
import { get } from '@ember/object';
import Service, { service } from '@ember/service';
import { Helper, helper } from '@ember/-internals/glimmer';

Expand Down Expand Up @@ -96,7 +97,7 @@ moduleFor(
nameBuilder;

compute() {
this.get('nameBuilder').build();
get(this, 'nameBuilder').build();
}
}
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { moduleFor, ApplicationTestCase, strip, runTask } from 'internal-test-helpers';

import { set } from '@ember/object';
import Service, { service } from '@ember/service';
import { Component, Helper } from '@ember/-internals/glimmer';

Expand Down Expand Up @@ -182,7 +183,7 @@ moduleFor(
tagName = '';
init() {
super.init(...arguments);
this.set('id', id++);
set(this, 'id', id++);
}
},
template: 'x-foo: {{@name}} ({{this.id}})',
Expand All @@ -193,7 +194,7 @@ moduleFor(
tagName = '';
init() {
super.init(...arguments);
this.set('id', id++);
set(this, 'id', id++);
}
},
template: 'x-bar ({{this.id}})',
Expand Down
Loading
Loading