Changing the display from form to wizard to form and then removing the panel breaks the builder

Aperta
#616 1 commento 0 reazioni 1 assegnatario Vedi su GitHub

@Tatsiana8 ci sta già lavorando.

Dal 25/6/2025.

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

Describe the bug
When you render the FormBuilder, if you change the display type from form to wizard and then back to form, the builder is still on wizard mode after adding a new component and the component you just tried to add disappear until you click on the +page button

To Reproduce
Steps to reproduce the behavior:

  1. Render the builder using the <FormBuilder /> component
  2. keep a reference to the builder using the onBuilderReady prop
  3. change the display type to wizard (using the builder reference)
  4. change the display type back to form (using the builder reference)
  5. remove the remaining panel
  6. add a new textfield

Expected behavior
The builder should be in form mode and behave normally

Screenshots
Gif demonstrating the issue

Image

Sandbox Example
builder-display-bug.zip

the zip file contain a simple vite app unzip it, run npm i and npm run dev to test the issue, here is the actual code used to recreate the bug:

import { FormBuilder } from "@formio/react";
import { useCallback, useRef } from "react";

function App() {
	const ref = useRef(null);
	const onBuilderReady = useCallback((builder) => {
		ref.current = builder;
	}, []);

    return (
        <>
			<select onChange={(e) => {
				ref.current.setDisplay(e.target.value);
			}}>
				<option value="form">form</option>
				<option value="wizard">wizard</option>
			</select>
			<FormBuilder onBuilderReady={onBuilderReady}/>
        </>
    );
}

export default App;

Desktop (please complete the following information):

  • OS: Windows
  • Browser Chrome
  • Version Version 137.0.7151.104 (Official Build) (64-bit)

Smartphone (please complete the following information):

Not tested

Lingua principale
TypeScript
Stelle
371
Fork
309
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di formio/react

Tutte le issue di formio/react

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.