Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 30, 2025

Describe the PR

Fixes Vue warning "Component was made a reactive object" when passing custom components to useModal, useToast, or usePopover composables.

// This was triggering the warning
const { create } = useModal()
create({ component: FeedbackModal }).show()

Root cause: toRef() makes objects deeply reactive, including any component property.

Fix: Replace toRef(obj) with isRef(obj) ? obj : shallowRef(obj) in:

  • useModal/index.ts
  • useToast/index.ts
  • usePopover/index.ts

shallowRef only tracks .value assignment without making nested properties reactive, preventing components from becoming reactive objects.

Small replication

https://stackblitz.com/edit/github-kpbciadc?file=src%2Fcomponents%2FComp.vue

PR checklist

What kind of change does this PR introduce? (check at least one)

  • Bugfix 🐛 - fix(...)
  • Feature - feat(...)
  • ARIA accessibility - fix(...)
  • Documentation update - docs(...)
  • Other (please describe)

The PR fulfills these requirements:

  • Pull request title and all commits follow the Conventional Commits convention or has an override in this pull request body This is very important, as the CHANGELOG is generated from these messages, and determines the next version type. Pull requests that do not follow conventional commits or do not have an override will be denied
Original prompt

This section details on the original issue you should resolve

<issue_title>useModal with custom component: Component was made a reactive object</issue_title>
<issue_description>### Describe the bug

I'm migrating my code to to use the new useModal composable, and for my custom modals, I'm getting this warning on the console whenever I create one.

const { create } = useModal();
create({ component: FeedbackModal }).show();
Vue received a Component that was made a reactive object. This can lead to unnecessary performance overhead and should be avoided by marking the component with `markRaw` or using `shallowRef` instead of `ref`. 
Component that was made reactive:  
Object { __name: "FeedbackModal", ...

I've tried using markRaw on the imported component , but it made no difference. I see in the source that it should already be applying markRaw to the component instance, so I'm not sure why this is happening.

Reproduction

https://stackblitz.com/edit/github-kpbciadc?file=src%2Fcomponents%2FComp.vue

Used Package Manager

npm</issue_description>

<agent_instructions> const resolvedProps = isRef(obj) ? obj : shallowRef(obj)
this should be enough... fix the other composables also that have the same problem.</agent_instructions>

Comments on the Issue (you are @copilot in this section)

@xvaara ```ts import { markRaw } from 'vue' create({ component: markRaw(MyModal) }).show() ```

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@bolt-new-by-stackblitz
Copy link

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 30, 2025

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Comment @coderabbitai help to get the list of available commands and usage tips.

Copilot AI changed the title [WIP] Fix reactive component warning for useModal fix(composables): use shallowRef to prevent reactive component warning Nov 30, 2025
Copilot AI requested a review from xvaara November 30, 2025 23:06
@pkg-pr-new
Copy link

pkg-pr-new bot commented Dec 1, 2025

  • bsvn-vite-ts

    npm i https://pkg.pr.new/bootstrap-vue-next/bootstrap-vue-next@2930
    
    npm i https://pkg.pr.new/bootstrap-vue-next/bootstrap-vue-next/@bootstrap-vue-next/nuxt@2930
    

commit: ffeecc6

@VividLemon VividLemon marked this pull request as ready for review December 12, 2025 14:58
@VividLemon VividLemon merged commit 4b1e12b into main Dec 12, 2025
8 checks passed
@github-actions github-actions bot mentioned this pull request Dec 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

useModal with custom component: Component was made a reactive object

3 participants