@@ -44,6 +44,7 @@ export function unwrap<Value, Args extends unknown[], Result, PendingValue>(
44
44
const promiseErrorCache = new WeakMap < Promise < unknown > , unknown > ( )
45
45
const promiseResultCache = new WeakMap < Promise < unknown > , Awaited < Value > > ( )
46
46
const refreshAtom = atom ( 0 )
47
+ refreshAtom . debugLabel = 'refresh'
47
48
48
49
if ( import . meta. env ?. MODE !== 'production' ) {
49
50
refreshAtom . debugPrivate = true
@@ -89,14 +90,15 @@ export function unwrap<Value, Args extends unknown[], Result, PendingValue>(
89
90
set ( refreshAtom , ( c ) => c + 1 )
90
91
} ,
91
92
)
93
+ promiseAndValueAtom . debugLabel = 'promiseAndValue'
92
94
// HACK to read PromiseAndValue atom before initialization
93
95
promiseAndValueAtom . init = undefined
94
96
95
97
if ( import . meta. env ?. MODE !== 'production' ) {
96
98
promiseAndValueAtom . debugPrivate = true
97
99
}
98
100
99
- return atom (
101
+ const unwrappedAtom = atom (
100
102
( get ) => {
101
103
const state = get ( promiseAndValueAtom )
102
104
if ( 'f' in state ) {
@@ -108,6 +110,8 @@ export function unwrap<Value, Args extends unknown[], Result, PendingValue>(
108
110
( _get , set , ...args ) =>
109
111
set ( anAtom as WritableAtom < Value , unknown [ ] , unknown > , ...args ) ,
110
112
)
113
+ unwrappedAtom . debugLabel = 'unwrapped'
114
+ return unwrappedAtom
111
115
} ,
112
116
anAtom ,
113
117
fallback ,
0 commit comments