Skip to content

Commit

Permalink
fix: small fixes
Browse files Browse the repository at this point in the history
`hasFieldValue` should return undefined instead of empty string to reset
default folder.
  • Loading branch information
SheffeyG committed Oct 7, 2024
1 parent 3f3f7d5 commit 287f9e7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/utils/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ export class Options {
return key in this.#options && this.#options[key] === value;
}

getFieldValue(key: string): string {
getFieldValue(key: string): string | undefined {
if (key in this.#options) {
// Unescape spaces to get real value
return this.#options[key].replace(/^"(.*)"$/, "$1").replace(/\\ /g, " ");
}
return "";
return undefined;
}

setFieldValue(key: string, value: string): string {
Expand Down
4 changes: 2 additions & 2 deletions src/utils/patch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ const contextMenuPatch = (LibraryContextMenu: any) => {
if (!patches.inner) {
patches.inner = afterPatch(component.type.prototype, "shouldComponentUpdate", ([nextProps]: any, shouldUpdate: any) => {
try {
const sgdbIdx = nextProps.children.findIndex((x: any) => x?.key === "cheat-deck");
if (sgdbIdx != -1) nextProps.children.splice(sgdbIdx, 1);
const idx = nextProps.children.findIndex((x: any) => x?.key === "cheat-deck");
if (idx != -1) nextProps.children.splice(idx, 1);
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
catch (error) {
Expand Down
4 changes: 1 addition & 3 deletions src/views/Custom/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,7 @@ const Custom: FC<{ appid: number }> = ({ appid }) => {
cusOptList.map((opt: CustomOption) => (
// eslint-disable-next-line react/jsx-key
<Focusable className="CD_EntryContainer">
<Focusable
className="CD_ToggleContainer"
>
<Focusable className="CD_ToggleContainer">
<ToggleField
bottomSeparator="none"
label={<span className="CD_Label">{opt.label}</span>}
Expand Down

0 comments on commit 287f9e7

Please sign in to comment.