@@ -65,6 +65,7 @@ interface DropdownProps {
6565 interpreter : string ;
6666 isEditable : boolean ;
6767 editor : any ;
68+ dropdown : any ;
6869
6970 onNameUpdate : ( name : string ) => void ;
7071 onOptionsUpdate : ( type : OptionType , options : string ) => void ;
@@ -248,6 +249,7 @@ const CommandTab = ({
248249
249250const Dropdown = ( {
250251 id,
252+ dropdown,
251253 name = "" ,
252254 options = "" ,
253255 value = "" ,
@@ -279,6 +281,20 @@ const Dropdown = ({
279281 }
280282 } , [ name ] ) ;
281283
284+ useEffect ( function fixMissingOptions ( ) {
285+ // We've seen cases where `options` is populated, but none of
286+ // `fixedOptions`, `variableOptions` or `commandOptions` are.
287+ // In these cases, `optionsType` is set. So, if we detect this scenario,
288+ // check that `optionsType` is fixed and populate the missing options.
289+ const { fixedOptions } = dropdown . props ;
290+
291+ if ( options !== "" && fixedOptions === "" && optionsType === "fixed" ) {
292+ if ( optionsType === "fixed" ) {
293+ onOptionsUpdate ( OptionType . FIXED , options ) ;
294+ }
295+ }
296+ } , [ ] ) ;
297+
282298 const optionsChangeHandler = useCallback (
283299 ( type : OptionType ) => ( options : string ) => onOptionsUpdate ( type , options ) ,
284300 [ onOptionsUpdate ] ,
@@ -537,6 +553,7 @@ export default createReactBlockSpec(
537553 return (
538554 < Dropdown
539555 editor = { editor }
556+ dropdown = { block }
540557 id = { block . id }
541558 name = { block . props . name }
542559 options = { block . props . options }
0 commit comments