-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Open
Open
Copy link
Description
Describe the problem
<script>
let num = $state(0);
let count = $state(1)
function treebleValue() {
return count * 3;
}
$effect(() => {
$inspect.trace('Effect Trace num + state in treebleValue ');
num; //track
let treebleCount = treebleValue();
});
</script>
<button onclick={()=>{num++}}>num: {num}</button>
<button onclick={()=>{count++}}>count : {count}</button>
In the first code in playground , you can see effect track num directly and track count in function ; So num and count will be trace together with inspect.trace

But you can see another code , if i add inspect.trac in Function called in effect , there will be two part log in console
<script>
let num = $state(0);
let count = $state(1)
function treebleValue() {
$inspect.trace('Function Trace - count');
return count * 3;
}
$effect(() => {
$inspect.trace('Effect Trace num + state in treebleValue ');
num; //track
let treebleCount = treebleValue();
});
</script>
<button onclick={()=>{num++}}>num: {num}</button>
<button onclick={()=>{count++}}>count : {count}</button>

Describe the proposed solution
But I want to show the log in a better way ; Function will be called in different effect ; so it will be better to show the effect who call this Function; And use nest style in log will be better

Importance
would make my life easier
Metadata
Metadata
Assignees
Labels
No labels