Skip to content

Commit

Permalink
Changed order of arguments to applyToStateOnMount
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenthoms committed Oct 12, 2023
1 parent 905ca69 commit ba0d6d2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions frontend/src/framework/InitialSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ export class InitialSettings {
}

export function applyToStateOnMount(
initialSettings: InitialSettings | undefined,
settingName: string,
type: keyof InitialSettingsSupportedTypes,
stateSetter: (value: any) => void,
initialSettings: InitialSettings | undefined
stateSetter: (value: any) => void
): void {
React.useEffect(() => {
if (initialSettings) {
Expand Down
14 changes: 7 additions & 7 deletions frontend/src/modules/DistributionPlot/settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@ export function settings({ moduleContext, workbenchServices, initialSettings }:
const [orientation, setOrientation] = moduleContext.useStoreState("orientation");
const [crossPlottingType, setCrossPlottingType] = React.useState<BroadcastChannelKeyCategory | null>(null);

applyToStateOnMount("channelNameX", "string", setChannelNameX, initialSettings);
applyToStateOnMount("channelNameY", "string", setChannelNameY, initialSettings);
applyToStateOnMount("channelNameZ", "string", setChannelNameZ, initialSettings);
applyToStateOnMount("plotType", "string", setPlotType, initialSettings);
applyToStateOnMount("numBins", "number", setNumBins, initialSettings);
applyToStateOnMount("orientation", "string", setOrientation, initialSettings);
applyToStateOnMount("crossPlottingType", "string", setCrossPlottingType, initialSettings);
applyToStateOnMount(initialSettings, "channelNameX", "string", setChannelNameX);
applyToStateOnMount(initialSettings, "channelNameY", "string", setChannelNameY);
applyToStateOnMount(initialSettings, "channelNameZ", "string", setChannelNameZ);
applyToStateOnMount(initialSettings, "plotType", "string", setPlotType);
applyToStateOnMount(initialSettings, "numBins", "number", setNumBins);
applyToStateOnMount(initialSettings, "orientation", "string", setOrientation);
applyToStateOnMount(initialSettings, "crossPlottingType", "string", setCrossPlottingType);

const handleChannelXChanged = (channelName: string) => {
setChannelNameX(channelName);
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/modules/TornadoChart/settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { State } from "./state";
export function settings({ moduleContext, workbenchServices, initialSettings }: ModuleFCProps<State>) {
const [responseChannelName, setResponseChannelName] = moduleContext.useStoreState("responseChannelName");

applyToStateOnMount("responseChannelName", "string", setResponseChannelName, initialSettings);
applyToStateOnMount(initialSettings, "responseChannelName", "string", setResponseChannelName);

function handleResponseChannelNameChange(channelName: string) {
setResponseChannelName(channelName);
Expand Down

0 comments on commit ba0d6d2

Please sign in to comment.