Skip to content

Commit

Permalink
fix(subsettings-pane): move const outside of callback
Browse files Browse the repository at this point in the history
  • Loading branch information
josh-willis-arcadis committed Sep 24, 2024
1 parent 46ee93f commit 5ba1bb3
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions packages/trip-form/src/MetroModeSelector/SubSettingsPane.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -189,13 +189,14 @@ export default function SubSettingsPane({
{ settingsNoSubmodes: [], settingsOnlySubmodes: [] }
);

// rental mode settings do not have type "SUBMODE"
const settingsWithTransportMode = modeButton.modeSettings.filter(
(s: ModeSetting) =>
(s.type === "CHECKBOX" || s.type === "SUBMODE") && s.addTransportMode
);

const handleSettingChange = useCallback(
(setting: ModeSetting) => (evt: QueryParamChangeEvent) => {
// rental mode settings do not have type "SUBMODE"
const settingsWithTransportMode = modeButton.modeSettings.filter(
(s: ModeSetting) =>
(s.type === "CHECKBOX" || s.type === "SUBMODE") && s.addTransportMode
);
// check if setting is a transport mode setting
if (settingsWithTransportMode.find(s => s.key === setting.key)) {
// check if all submodes are disabled
Expand Down

0 comments on commit 5ba1bb3

Please sign in to comment.