Skip to content

Commit cb2c10a

Browse files
committed
add init value to createHybridRef
1 parent 6939f55 commit cb2c10a

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

packages/jsx-runtime/jsx-utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export interface HybridRef<T> {
4242
readonly current_: PromiseSubject<T>;
4343
}
4444

45-
export const createHybridRef = <T>(): HybridRef<T> => {
45+
export const createHybridRef = <T>(init: T): HybridRef<T> => {
4646
const action = (target: HybridRef<T>, value: T) => {
4747
target.current = value;
4848
target.callbacks.forEach(cb => { try { cb(value) } catch (e) { console.error(e); } });
@@ -54,7 +54,7 @@ export const createHybridRef = <T>(): HybridRef<T> => {
5454
}
5555
}
5656
return new Proxy<HybridRef<T>>(Object.seal({
57-
current: undefined,
57+
current: init,
5858
next: new PromiseSubject<T>(),
5959
current_: new PromiseSubject<T>(),
6060
callbacks: [],

0 commit comments

Comments
 (0)