quick icon indicating copy to clipboard operation
quick copied to clipboard

fresh/refresh don't update subselect

Open davidAtInleague opened this issue 3 years ago • 0 comments

I've got a scope like

function scopeWithFoo( qb ) {
    return qb.addSubselect("foo", newEntity("someEntity").select("foo").whereSomething());
}

later we use the scope, but calling fresh/refresh doesn't update foo:

var base = getInstance("theModel").withFoo().firstOrFail();

// ... do things that update the foo value indirectly

var refreshedBase = base.fresh(); 
// does not reflect the change
refreshedBase.getFoo();

// does not reflect the change
base.refresh().getFoo(); 

// can see the change like this
getInstance("theModel").withFoo().whereTheModelID(base.getID()).getFoo();

thanks!

davidAtInleague avatar Jan 07 '22 23:01 davidAtInleague