NullVoxPopuli / ember-deep-tracked

Deep auto-tracking for when you just don't care, and want things to work (at the cost of performance in some situtations)
MIT License
30 stars 5 forks source link

Feature: allow partial proxying #336

Open jschmied opened 1 year ago

jschmied commented 1 year ago

is there a way to just replace a part of the model with a tracked proxy ?

Like if i have a.b = { x: "xx", y: "yy" } and do a.b = tracked(a.b) to replace instance of the sub-object with a proxy?

NullVoxPopuli commented 1 year ago

can you describe more about your use case? are proxies causing issues in some way?

atm, there is no way to out out of deep tracking at any depth when using deep tracking -- the only way to achieve your goal would be use normal tracking + tracked-built-ins. e.g.:

import { tracked } from '@glimmer/tracking';
import { TrackedObject } from 'tracked-built-ins';

class A {
  @tracked b;
}

let a = new A();

a.b = new TrackedObject({ x: 'xx', y: 'yy'}) 

but in this example, this kinda does the same thing as deep tracking, so if you could expand on your situation a bit, that be awesome :tada: