@@ -73,7 +73,7 @@ import {
73
73
vnode_setProp ,
74
74
type VNodeJournal ,
75
75
} from './vnode' ;
76
- import { mapArray_get , mapArray_set } from './util-mapArray' ;
76
+ import { mapArray_get , mapArray_has , mapArray_set } from './util-mapArray' ;
77
77
78
78
/** @public */
79
79
export function getDomContainer ( element : Element | VNode ) : IClientContainer {
@@ -220,20 +220,17 @@ export class DomContainer extends _SharedContainer implements IClientContainer {
220
220
221
221
setContext < T > ( host : HostElement , context : ContextId < T > , value : T ) : void {
222
222
let ctx = this . getHostProp < Array < string | unknown > > ( host , QCtxAttr ) ;
223
- if ( ! ctx ) {
223
+ if ( ctx == null ) {
224
224
this . setHostProp ( host , QCtxAttr , ( ctx = [ ] ) ) ;
225
225
}
226
- mapArray_set ( ctx , context . id , value , 0 ) ;
226
+ mapArray_set ( ctx , context . id , value , 0 , true ) ;
227
227
}
228
228
229
229
resolveContext < T > ( host : HostElement , contextId : ContextId < T > ) : T | undefined {
230
230
while ( host ) {
231
231
const ctx = this . getHostProp < Array < string | unknown > > ( host , QCtxAttr ) ;
232
- if ( ctx ) {
233
- const value = mapArray_get ( ctx , contextId . id , 0 ) as T ;
234
- if ( value ) {
235
- return value as T ;
236
- }
232
+ if ( ctx != null && mapArray_has ( ctx , contextId . id , 0 ) ) {
233
+ return mapArray_get ( ctx , contextId . id , 0 ) as T ;
237
234
}
238
235
host = this . getParentHost ( host ) ! ;
239
236
}
0 commit comments