Skip to content

Commit

Permalink
fix no container error
Browse files Browse the repository at this point in the history
  • Loading branch information
Varixo committed Aug 17, 2024
1 parent 598747e commit 09ab2da
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 3 additions & 1 deletion packages/qwik/src/core/v2/signal/v2-signal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,9 @@ export class Signal2<T = any> extends Subscriber implements ISignal2<T> {
const ctx = tryGetInvokeContext();
if (ctx) {
if (this.$container$ === null) {
assertDefined(ctx.$container2$, 'container should be in context ');
if (!ctx.$container2$) {
return this.untrackedValue;
}
// Grab the container now we have access to it
this.$container$ = ctx.$container2$;
} else {
Expand Down
8 changes: 5 additions & 3 deletions packages/qwik/src/core/v2/signal/v2-store.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { pad, qwikDebugToString } from '../../debug';
import { assertDefined, assertTrue } from '../../error/assert';
import { assertTrue } from '../../error/assert';
import { tryGetInvokeContext } from '../../use/use-core';
import { isSerializableObject } from '../../util/types';
import type { VNode } from '../client/types';
Expand Down Expand Up @@ -126,9 +126,12 @@ export class StoreHandler<T extends Record<string | symbol, any>> implements Pro
}
const target = this.$target$;
const ctx = tryGetInvokeContext();
let value = target[p];
if (ctx) {
if (this.$container$ === null) {
assertDefined(ctx.$container2$, 'container should be in context ');
if (!ctx.$container2$) {
return value;
}
// Grab the container now we have access to it
this.$container$ = ctx.$container2$;
} else {
Expand Down Expand Up @@ -160,7 +163,6 @@ export class StoreHandler<T extends Record<string | symbol, any>> implements Pro
DEBUG && log('read->sub', pad('\n' + this.toString(), ' '));
}
}
let value = target[p];
if (p === 'toString' && value === Object.prototype.toString) {
return Store.prototype.toString;
}
Expand Down

0 comments on commit 09ab2da

Please sign in to comment.