#Is there a way to debug _which code_ is changing a `ref`?

6 messages · Page 1 of 1 (latest)

sharp kettle
#

Hello I have a watcher on a ref, I noticed that when I change a value of it, after some delay it gets reset to the previous value.

I am so far struggling to understand what is changing this value. Any debugging tool I could use?

icy current
#

Hey there @sharp kettle , could you please create a reproduction of your code, or just share a snippet?

sharp kettle
#

I had a watcheffect buried down in a child @icy current

#

But my question was more general tbh

viscid pasture
#

Had the same problem, temporarily did this and looked at the call stack. Not ideal, but...

    const _variable = ref("some_value");

    const variable = computed({
        get: () => _variable.value,
        set: nextValue => {
            debugger;
            _variable.value = nextValue;
        }
    });
icy current
#

I believe it has something to do with Hydration.