diff --git a/packages/qwik/src/core/v2/signal/v2-store.ts b/packages/qwik/src/core/v2/signal/v2-store.ts index 79172f38b89..c9bf8fdf1a2 100644 --- a/packages/qwik/src/core/v2/signal/v2-store.ts +++ b/packages/qwik/src/core/v2/signal/v2-store.ts @@ -167,6 +167,7 @@ export class StoreHandler implements ProxyHandler { if (typeof prop != 'string' || !delete target[prop]) { return false; } + triggerEffects(this.$container$, this, getEffects(target, prop, this.$effects$)); return true; } diff --git a/packages/qwik/src/core/v2/tests/use-store.spec.tsx b/packages/qwik/src/core/v2/tests/use-store.spec.tsx index 3bdd6b696f2..83b2566a8ed 100644 --- a/packages/qwik/src/core/v2/tests/use-store.spec.tsx +++ b/packages/qwik/src/core/v2/tests/use-store.spec.tsx @@ -595,6 +595,30 @@ describe.each([ expect((global as any).logs).toEqual([false, true]); }); + it('should trigger effects on property delete', async () => { + const Cmp = component$(() => { + const store = useStore<{ delete?: string }>({ delete: 'test' }); + return
delete store.delete}>{store.delete}
; + }); + + const { vNode, document } = await render(, { debug }); + expect(vNode).toMatchVDOM( + +
+ {'test'} +
+
+ ); + await trigger(document.body, 'div', 'click'); + expect(vNode).toMatchVDOM( + +
+ +
+
+ ); + }); + describe('regression', () => { it('#5597 - should update value', async () => { (globalThis as any).clicks = 0;