File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -204,6 +204,13 @@ export const Editor = () => {
204204 return ;
205205 }
206206
207+ if ( PossibleTransitionValues . includes ( row . state ) ) {
208+ setAlertMessage (
209+ `State name cannot be ${ PossibleTransitionValues . join ( ", " ) } `
210+ ) ;
211+ return ;
212+ }
213+
207214 PossibleTransitionValues . forEach (
208215 ( key ) =>
209216 ( row [ key === "^" ? "nul" : key ] = Array . from (
Original file line number Diff line number Diff line change 11import { DraggableStateModel } from "../models" ;
22import { StateNameMaxLength } from "../consts/StateNameMaxLength" ;
3+ import { PossibleTransitionValues } from "../consts/PossibleTransitionValues" ;
34
45export const promptNewStateName = (
56 states : DraggableStateModel [ ] ,
@@ -9,7 +10,8 @@ export const promptNewStateName = (
910 while (
1011 ! newName ||
1112 ( newName && [ ...states ] . map ( ( s ) => s . id ) . includes ( newName ) ) ||
12- newName . length > StateNameMaxLength
13+ newName . length > StateNameMaxLength ||
14+ PossibleTransitionValues . includes ( newName )
1315 ) {
1416 if ( ! newName )
1517 newName = prompt (
@@ -26,6 +28,13 @@ export const promptNewStateName = (
2628 `State name cannot be more than ${ StateNameMaxLength } characters.` ,
2729 originalName
2830 ) ;
31+ else if ( PossibleTransitionValues . includes ( newName ) )
32+ newName = prompt (
33+ `State name cannot be one of the following: ${ PossibleTransitionValues . join (
34+ ", "
35+ ) } `,
36+ originalName
37+ ) ;
2938 }
3039 return newName ;
3140} ;
You can’t perform that action at this time.
0 commit comments