Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 12, 2025

Description

Fixes an issue introduced in v0.40.0 where modals created with useModal().create() were not displaying titles defined in the component itself.

Problem

When using useModal with a custom component that defines its own title prop, the title would not display:

<!-- MyModal.vue -->
<template>
  <BModal title="My title">This is a modal.</BModal>
</template>

<!-- Calling component -->
<script setup>
import { useModal } from 'bootstrap-vue-next';
const { create } = useModal();
const showModal = () => create({ component: MyModal }).show();
</script>

The title "My title" would not appear in the rendered modal. However, if the title was passed directly to create({ title: "My title" }), it would display correctly.

Root Cause

In orchestratorShared.ts, the buildPromise function's set method was unconditionally setting title and body properties to their resolved values, even when they were undefined. This caused undefined values to override the component's own prop definitions.

Solution

Modified the set method to only include title and body in the store update if they are explicitly defined and not undefined. This allows component-defined props to take precedence when no override is provided.

Changes

  • Updated packages/bootstrap-vue-next/src/composables/orchestratorShared.ts to conditionally set title and body properties
  • Added comprehensive tests in packages/bootstrap-vue-next/src/composables/orchestratorShared.spec.ts to verify the fix

Testing

  • ✅ All existing tests pass (1633 tests)
  • ✅ New tests verify title/body behavior
  • ✅ Build successful
  • ✅ Linting passes

Closes #[issue number]

Original prompt

This section details on the original issue you should resolve

<issue_title>Modals created with useModal not showing title defined in component</issue_title>
<issue_description>### Describe the bug

If I create a modal with useModal where the title is defined in an external component, it does not display. This began with the v0.40.0 release. e.g.
MyModal.vue:

<template>
  <BModal title="My title">This is a modal.</BModal>
</template>

Calling component:

<script setup>
import { useModal } from 'bootstrap-vue-next';
const { create } = useModal();
const showModal = () => create({ component: MyModal }).show();
</script>

If I add the title prop directly to the create() call, then it displays fine.

Reproduction

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

Used Package Manager

pnpm</issue_description>

<agent_instructions>In orchestratorShared.ts function buildPromise we create the functionality for the orchestration of modals, etc. on line 77 and 78 we set the title and body to a value, it might be undefined. We should not add them to the object even as undefined if they are not in the v variable.</agent_instructions>

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

Fixes #2877


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@bolt-new-by-stackblitz
Copy link

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

@coderabbitai
Copy link

coderabbitai bot commented Oct 12, 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 modal title not displaying when using useModal Fix modals created with useModal not showing title defined in component Oct 12, 2025
Copilot AI requested a review from xvaara October 12, 2025 00:36
@xvaara xvaara marked this pull request as ready for review October 12, 2025 00:47
@pkg-pr-new
Copy link

pkg-pr-new bot commented Oct 12, 2025

bsvn-vite-ts

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

commit: 7f43544

@xvaara xvaara merged commit 696a602 into main Oct 12, 2025
8 checks passed
@xvaara xvaara deleted the copilot/fix-modal-title-display branch October 12, 2025 00:55
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.

Modals created with useModal not showing title defined in component

2 participants