File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -544,7 +544,7 @@ export const Editor = () => {
544544 stateY = e . clientY - rect . y ;
545545 }
546546
547- setStateNameDialogValue ( `q ${ rowId } ` ) ;
547+ setStateNameDialogValue ( getNextStateName ( ) ) ;
548548 setIsStateNameDialogOpen ( true ) ;
549549 setStateDropPosition ( { stateX, stateY } ) ;
550550 } ;
@@ -633,6 +633,14 @@ export const Editor = () => {
633633 setToolSelected ( null ) ;
634634 } ;
635635
636+ function getNextStateName ( ) {
637+ if ( rows && rows ?. [ rows ?. length - 1 ] ?. state ?. [ 0 ] === "q" ) {
638+ const stateNumber = parseInt ( rows ?. [ rows ?. length - 1 ] ?. state ?. slice ( 1 ) ) ;
639+ if ( stateNumber >= 0 ) return `q${ stateNumber + 1 } ` ;
640+ }
641+ return `q${ rowId } ` ;
642+ }
643+
636644 const transitionTableProps : TransitionTableProps = {
637645 rows,
638646 columns,
@@ -758,7 +766,7 @@ export const Editor = () => {
758766 handleAddRow (
759767 new RowModel (
760768 rowId ,
761- `q ${ rowId } ` ,
769+ getNextStateName ( ) ,
762770 "" ,
763771 "" ,
764772 "" ,
You can’t perform that action at this time.
0 commit comments