@@ -9,11 +9,11 @@ import type {
99import { useFrontendClient } from "./frontend-client-context" ;
1010import type { ComponentFormProps } from "../components/ComponentForm" ;
1111
12- export type DynamicProps < T extends ConfigurableProps > = { id : string ; configurable_props : T ; } ; // TODO
12+ export type DynamicProps < T extends ConfigurableProps > = { id : string ; configurableProps : T ; } ; // TODO
1313
1414export type FormContext < T extends ConfigurableProps > = {
1515 component : V1Component < T > ;
16- configurableProps : T ; // dynamicProps.configurable_props || props.component.configurable_props
16+ configurableProps : T ; // dynamicProps.configurableProps || props.component.configurable_props
1717 configuredProps : ConfiguredProps < T > ;
1818 dynamicProps ?: DynamicProps < T > ; // lots of calls require dynamicProps?.id, so need to expose
1919 dynamicPropsQueryIsFetching ?: boolean ;
@@ -117,11 +117,11 @@ export const FormContextProvider = <T extends ConfigurableProps>({
117117 "dynamicProps" ,
118118 ] ,
119119 queryFn : async ( ) => {
120- const { dynamic_props } = await client . componentReloadProps ( componentReloadPropsInput ) ;
120+ const { dynamicProps } = await client . componentReloadProps ( componentReloadPropsInput ) ;
121121 // XXX what about if null?
122122 // TODO observation errors, etc.
123- if ( dynamic_props ) {
124- setDynamicProps ( dynamic_props ) ;
123+ if ( dynamicProps ) {
124+ setDynamicProps ( dynamicProps ) ;
125125 }
126126 setReloadPropIdx ( undefined ) ;
127127 return [ ] ; // XXX ok to mutate above and not look at data?
@@ -130,7 +130,7 @@ export const FormContextProvider = <T extends ConfigurableProps>({
130130 } ) ;
131131
132132 // XXX fix types of dynamicProps, props.component so this type decl not needed
133- let configurableProps : T = dynamicProps ?. configurable_props || formProps . component . configurable_props || [ ] ;
133+ let configurableProps : T = dynamicProps ?. configurableProps || formProps . component . configurable_props || [ ] ;
134134 if ( propNames ?. length ) {
135135 const _configurableProps = [ ] ;
136136 for ( const prop of configurableProps ) {
@@ -169,7 +169,7 @@ export const FormContextProvider = <T extends ConfigurableProps>({
169169 errs . push ( "not a boolean" ) ;
170170 }
171171 } else if ( prop . type === "string" ) {
172- if ( typeof value !== "string" ) {
172+ if ( typeof value !== "string" ) {
173173 errs . push ( "not a string" ) ;
174174 }
175175 } else if ( prop . type === "app" ) {
@@ -179,7 +179,7 @@ export const FormContextProvider = <T extends ConfigurableProps>({
179179 } ;
180180
181181 const updateConfiguredPropsQueryDisabledIdx = ( configuredProps : ConfiguredProps < T > ) => {
182- let _queryDisabledIdx = undefined ;
182+ let _queryDisabledIdx = undefined ;
183183 for ( let idx = 0 ; idx < configurableProps . length ; idx ++ ) {
184184 const prop = configurableProps [ idx ] ;
185185 if ( prop . hidden || ( prop . optional && ! optionalPropIsEnabled ( prop ) ) ) {
@@ -241,7 +241,10 @@ export const FormContextProvider = <T extends ConfigurableProps>({
241241 ] ) ;
242242
243243 // clear all props on user change
244- const [ prevUserId , setPrevUserId ] = useState ( userId )
244+ const [
245+ prevUserId ,
246+ setPrevUserId ,
247+ ] = useState ( userId )
245248 useEffect ( ( ) => {
246249 if ( prevUserId !== userId ) {
247250 updateConfiguredProps ( { } ) ;
0 commit comments