Subscribe on changes!

Patch triggers 'set' on proxy: trap returned falsish for property 'default'

avatar
Apr 28th 2023

Vue version

3.3.0-beta.2

Link to minimal reproduction

https://stackblitz.com/edit/github-oh8bn2?file=src/App.vue

Steps to reproduce

To trigger the bug, modify/save the file to trigger HMR. This is also reproducible in other situations, such as when navigating or triggering rerender in more complex contexts.

<script setup>
import { h } from 'vue';

const CompA = {
  setup(props, context) {
    return () => context.slots.default?.();
  },
};
const CompB = {
  setup(props, context) {
    return () => h(CompA, context.attrs, context.slots);
  },
};
</script>

<template>
  <div>
    <CompB>
      <!-- modify file to trigger bug -->
      test
    </CompB>
  </div>
</template>

What is expected?

I expect this to work.

What is actually happening?

The following error is thrown:

TypeError: 'set' on proxy: trap returned falsish for property 'default'
    at assign (<anonymous>)
    at updateSlots (chunk-BR2FAMHR.js?v=3f9a97d3:5769:9)
    at updateComponentPreRender (chunk-BR2FAMHR.js?v=3f9a97d3:7221:5)
    at ReactiveEffect.componentUpdateFn [as fn] (chunk-BR2FAMHR.js?v=3f9a97d3:7141:11)
    at ReactiveEffect.run (chunk-BR2FAMHR.js?v=3f9a97d3:423:19)
    at instance.update (chunk-BR2FAMHR.js?v=3f9a97d3:7205:52)
    at updateComponent (chunk-BR2FAMHR.js?v=3f9a97d3:7032:18)
    at processComponent (chunk-BR2FAMHR.js?v=3f9a97d3:6967:7)
    at patch (chunk-BR2FAMHR.js?v=3f9a97d3:6429:11)
    at ReactiveEffect.componentUpdateFn [as fn] (chunk-BR2FAMHR.js?v=3f9a97d3:7164:9)
(

System Info

No response

Any additional comments?

This seems to be a similar issue: https://github.com/vuejs/core/issues/5307.

Downstream PR: https://github.com/nuxt/nuxt/pull/20478