diff --git a/src/SelfServe/Example/SelfServeExample.tsx b/src/SelfServe/Example/SelfServeExample.tsx index a5b04fad1..739e49cda 100644 --- a/src/SelfServe/Example/SelfServeExample.tsx +++ b/src/SelfServe/Example/SelfServeExample.tsx @@ -24,11 +24,6 @@ export const regionDropdownInfo: Info = { message: "More regions can be added in the future." }; -export const delay = (ms: number): Promise => { - console.log("delay called"); - return new Promise(resolve => setTimeout(resolve, ms)); -}; - const onDbThroughputChange = (currentState: Map, newValue: InputType): Map => { currentState.set("dbThroughput", newValue); currentState.set("collectionThroughput", newValue); @@ -36,7 +31,6 @@ const onDbThroughputChange = (currentState: Map, newValue: In }; const initializeMaxThroughput = async (): Promise => { - await delay(2000); return 10000; }; @@ -76,7 +70,6 @@ export default class SelfServeExample extends SelfServeBaseClass { in the SessionStorage. */ public onSubmit = async (currentValues: Map): Promise => { - await delay(1000); SessionStorageUtility.setEntry("regions", currentValues.get("regions")?.toString()); SessionStorageUtility.setEntry("enableLogging", currentValues.get("enableLogging")?.toString()); SessionStorageUtility.setEntry("accountName", currentValues.get("accountName")?.toString()); @@ -100,7 +93,6 @@ export default class SelfServeExample extends SelfServeBaseClass { for these fields. These are then set when the changes are submitted. */ public initialize = async (): Promise> => { - await delay(1000); const defaults = new Map(); defaults.set("regions", SessionStorageUtility.getEntry("regions")); defaults.set("enableLogging", SessionStorageUtility.getEntry("enableLogging") === "true"); diff --git a/src/SelfServe/PropertyDecorators.tsx b/src/SelfServe/PropertyDecorators.tsx index 9733fd360..a6fc9ae5b 100644 --- a/src/SelfServe/PropertyDecorators.tsx +++ b/src/SelfServe/PropertyDecorators.tsx @@ -33,17 +33,17 @@ export interface ChoiceInputOptions extends InputOptionsBase { type InputOptions = NumberInputOptions | StringInputOptions | BooleanInputOptions | ChoiceInputOptions; -function isNumberInputOptions(inputOptions: InputOptions): inputOptions is NumberInputOptions { +const isNumberInputOptions = (inputOptions: InputOptions): inputOptions is NumberInputOptions => { return "min" in inputOptions; -} +}; -function isBooleanInputOptions(inputOptions: InputOptions): inputOptions is BooleanInputOptions { +const isBooleanInputOptions = (inputOptions: InputOptions): inputOptions is BooleanInputOptions => { return "trueLabel" in inputOptions; -} +}; -function isChoiceInputOptions(inputOptions: InputOptions): inputOptions is ChoiceInputOptions { +const isChoiceInputOptions = (inputOptions: InputOptions): inputOptions is ChoiceInputOptions => { return "choices" in inputOptions; -} +}; const addToMap = (...decorators: Decorator[]): PropertyDecorator => { return (target, property) => { diff --git a/src/SelfServe/SelfServeComponent.tsx b/src/SelfServe/SelfServeComponent.tsx index 01464573e..7bb6208a1 100644 --- a/src/SelfServe/SelfServeComponent.tsx +++ b/src/SelfServe/SelfServeComponent.tsx @@ -105,17 +105,16 @@ export class SelfServeComponent extends React.Component { - console.log("discarding"); let { currentValues } = this.state; const { baselineValues } = this.state; for (const key of baselineValues.keys()) { currentValues = currentValues.set(key, baselineValues.get(key)); } - this.setState({ currentValues: currentValues }); + this.setState({ currentValues }); }; private initializeSmartUiNode = async (currentNode: Node): Promise => { diff --git a/src/SelfServe/SelfServeLoadingComponentAdapter.tsx b/src/SelfServe/SelfServeLoadingComponentAdapter.tsx index 320b9b517..a27ae1ece 100644 --- a/src/SelfServe/SelfServeLoadingComponentAdapter.tsx +++ b/src/SelfServe/SelfServeLoadingComponentAdapter.tsx @@ -20,6 +20,6 @@ export class SelfServeLoadingComponentAdapter implements ReactAdapter { } private triggerRender() { - window.requestAnimationFrame(() => this.parameters(Date.now())); + window.requestAnimationFrame(() => this.renderComponent()); } } diff --git a/src/SelfServe/SelfServeUtils.tsx b/src/SelfServe/SelfServeUtils.tsx index f735ade66..a2fa9197a 100644 --- a/src/SelfServe/SelfServeUtils.tsx +++ b/src/SelfServe/SelfServeUtils.tsx @@ -82,10 +82,8 @@ export const addPropertyToMap = { - let context = Reflect.getMetadata(className, target) as Map; - if (!context) { - context = new Map(); - } + const context = + (Reflect.getMetadata(className, target) as Map) ?? new Map(); updateContextWithDecorator(context, propertyName, className, descriptorName, descriptorValue); Reflect.defineMetadata(className, context, target); }; @@ -104,10 +102,7 @@ export const updateContextWithDecorator =