Skip to content

Commit

Permalink
next/software: fix erroneous memoization by removing useMemo
Browse files Browse the repository at this point in the history
  • Loading branch information
haraldschilly committed Dec 19, 2024
1 parent 7f1695c commit b8c28fc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/packages/next/components/landing/software-libraries.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export default function SoftwareLibraries(props: Props) {
debounce((e) => {
setSearch(e.target.value);
}, 500),
[]
[],
);

let data: Item[];
Expand All @@ -74,7 +74,7 @@ export default function SoftwareLibraries(props: Props) {
}
}

const columns = useMemo((): Columns => {
function columns(): Columns {
const envs = Object.entries(spec);
const width = (100 - libWidthPct) / envs.length;

Expand All @@ -98,7 +98,7 @@ export default function SoftwareLibraries(props: Props) {
}

return columns;
}, [libWidthPct]);
}

return (
<div>
Expand All @@ -112,7 +112,7 @@ export default function SoftwareLibraries(props: Props) {
/>
<div style={{ overflowX: "auto", width: "100%" }}>
<Table
columns={columns}
columns={columns()}
bordered
pagination={false}
rowKey={"index"}
Expand Down
1 change: 0 additions & 1 deletion src/packages/next/lib/landing/software-specs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ async function downloadInventoryJson(name: SoftwareEnvNames): Promise<EnvData> {
}

// load the current version of the software specs – if there is a problem, use the locally stored files as fallback.
// both files go hand-in-hand, hence either both work or both are the fallback!
async function fetchInventory(): Promise<SoftwareEnvironments> {
// for development, set the env variable to directory, where this files are
const localSpec = process.env.COCALC_SOFTWARE_ENVIRONMENTS;
Expand Down

0 comments on commit b8c28fc

Please sign in to comment.