Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stepper: Nested Components are re-mounted #6052

Closed
rickngo opened this issue Jul 11, 2024 · 1 comment · Fixed by #6054
Closed

Stepper: Nested Components are re-mounted #6052

rickngo opened this issue Jul 11, 2024 · 1 comment · Fixed by #6054
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@rickngo
Copy link
Contributor

rickngo commented Jul 11, 2024

Describe the bug

When using the Stepper component and its associated components (StepPanels, etc.), nested components are being re-mounted when navigating steps.

Possibly, each StepPanel is being re-mounted even for non-nested components, but since the ref variable is located in the parent component, then it appears like it is not being re-mounted.

Reproducer

https://stackblitz.com/edit/primevue-4-vite-issue-template-nxw9yy?file=src%2FApp.vue

PrimeVue version

4.0.0

Vue version

3.x

Language

TypeScript

Build / Runtime

Vue CLI App

Browser(s)

Chrome, Safari

Steps to reproduce the behavior

See StackBlitz.

Essentially, create a component and then nest it in the StepPanel. When navigating steps, the component is being re-mounted/re-rendered.

Expected behavior

Ideally, StepPanels should only show/hide the nested components as otherwise, all form information could possibly be lost.

@rickngo rickngo added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Jul 11, 2024
@rickngo
Copy link
Contributor Author

rickngo commented Jul 12, 2024

After looking at StepPanel.vue, I think this stems from the use of v-if rather than v-show in the <template v-else> block:

 <template v-else>
        <template v-if="!asChild">
            <component v-if="active" :is="as" :id="id" :class="cx('root')" role="tabpanel" :aria-controls="ariaControls" v-bind="getPTOptions('root')">

should be:

 <template v-else>
        <template v-if="!asChild">
            <component v-show="active" :is="as" :id="id" :class="cx('root')" role="tabpanel" :aria-controls="ariaControls" v-bind="getPTOptions('root')">

I tested using a Vertical Stepper (which does have v-show) and everything works as expected

@tugcekucukoglu tugcekucukoglu added Type: Bug Issue contains a bug related to a specific component. Something about the component is not working and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Jul 22, 2024
@tugcekucukoglu tugcekucukoglu added this to the 4.0.1 milestone Jul 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants