Skip to content

Commit b9bc67b

Browse files
Remove TrackedArray
1 parent d4051de commit b9bc67b

2 files changed

Lines changed: 7 additions & 17 deletions

File tree

app/components/colors-list.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import { fadeOut } from 'ember-animated/motions/opacity';
99
import type { Store } from 'ember-orbit';
1010

1111
import type { RecordOperationTerm } from '@orbit/records';
12-
import { TrackedArray } from 'tracked-built-ins';
1312

1413
import 'swach/components/color-row';
1514
import type ColorModel from 'swach/data-models/color';
@@ -78,11 +77,9 @@ export default class ColorsListComponent extends Component<ColorsListSignature>
7877
const { palette } = this.args;
7978

8079
if (color && palette && !palette.isLocked) {
81-
const colorsList = new TrackedArray<{ type: string; id: string }>(
82-
palette.colors.map((color) => {
83-
return { type: 'color', id: color.id };
84-
}),
85-
);
80+
const colorsList = palette.colors.map((color) => {
81+
return { type: 'color', id: color.id };
82+
});
8683

8784
const colorToRemove = colorsList.find((c) => c.id === color.id);
8885

app/controllers/palettes.ts

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import { tracked } from '@glimmer/tracking';
77
import type { LiveQuery, Store } from 'ember-orbit';
88

99
import type { RecordOperationTerm } from '@orbit/records';
10-
import { TrackedArray } from 'tracked-built-ins';
1110

1211
import type ApplicationController from 'swach/controllers/application';
1312
import type ColorModel from 'swach/data-models/color';
@@ -169,7 +168,7 @@ export default class PalettesController extends Controller {
169168
...attributes,
170169
createdAt: new Date(),
171170
};
172-
const colorsList = new TrackedArray(targetList.map((c) => c.$identity));
171+
const colorsList = targetList.map((c) => c.$identity);
173172

174173
const existingColor = targetList.find((c) => c.hex === sourceColor.hex);
175174

@@ -211,9 +210,7 @@ export default class PalettesController extends Controller {
211210
sourcePalette: PaletteModel,
212211
targetIndex: number,
213212
): Promise<void> {
214-
const sourceColorList = new TrackedArray(
215-
sourceList.map((c) => c.$identity),
216-
);
213+
const sourceColorList = sourceList.map((c) => c.$identity);
217214
const colorToMove = sourceColorList.find((c) => c.id === sourceColor.id);
218215

219216
if (colorToMove) {
@@ -237,9 +234,7 @@ export default class PalettesController extends Controller {
237234
targetIndex: number,
238235
targetPalette: PaletteModel,
239236
): Promise<void> {
240-
const sourceColorOrder = new TrackedArray(
241-
sourceList.map((c) => c.$identity),
242-
);
237+
const sourceColorOrder = sourceList.map((c) => c.$identity);
243238
const colorToRemove = sourceColorOrder.find((c) => c.id === sourceColor.id);
244239

245240
if (colorToRemove) {
@@ -253,9 +248,7 @@ export default class PalettesController extends Controller {
253248

254249
if (!targetPalette.isColorHistory) {
255250
let insertIndex = targetIndex;
256-
const targetColorOrder = new TrackedArray(
257-
targetList.map((c) => c.$identity),
258-
);
251+
const targetColorOrder = targetList.map((c) => c.$identity);
259252
const existingColor = targetList.find(
260253
(c) => c.hex === sourceColor.hex,
261254
);

0 commit comments

Comments
 (0)