Skip to content

Commit

Permalink
Prevent revert icon from showing up for overridden fields
Browse files Browse the repository at this point in the history
  • Loading branch information
olegbl committed Dec 1, 2024
1 parent 0de5dfe commit 7b772c1
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/renderer/react/settings/ModSettingsField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ export default function ModSettingsField({
field,
mod,
}: Props): JSX.Element | null {
const overrideValue =
field.overrideValue == null
? null
: parseBinding<ModConfigSingleValue | null>(
field.overrideValue,
mod.config,
) ?? null;

const setModConfig = useSetModConfig();

const onChangeConfig = useCallback(
Expand Down Expand Up @@ -102,7 +110,8 @@ export default function ModSettingsField({
}}
>
{JSON.stringify(mod.config[field.id]) ===
JSON.stringify(field.defaultValue) ? null : (
JSON.stringify(field.defaultValue) ||
overrideValue != null ? null : (
<Tooltip title="Revert to Default">
<IconButton onClick={onReset} size="small">
<Refresh />
Expand Down

0 comments on commit 7b772c1

Please sign in to comment.