Hi, i’m having this error when using UI Kit 2
ReferenceError: window is not defined
at getCallBridge (webpack://forge-ui-starter/node_modules/@forge/bridge/out/bridge.js:9:1)
at Object.104 (webpack://forge-ui-starter/node_modules/@forge/bridge/out/invoke/invoke.js:7:1)
at __webpack_require__ (webpack://forge-ui-starter/webpack/bootstrap:19:1)
at Object.7312 (webpack://forge-ui-starter/node_modules/@forge/bridge/out/invoke/index.js:4:1)
at __webpack_require__ (webpack://forge-ui-starter/webpack/bootstrap:19:1)
at Object.3228 (webpack://forge-ui-starter/node_modules/@forge/bridge/out/index.js:4:1)
at __webpack_require__ (webpack://forge-ui-starter/webpack/bootstrap:19:1)
at Object.6540 (webpack://forge-ui-starter/node_modules/@forge/react/out/hooks/useProductContext.js:4:1)
at __webpack_require__ (webpack://forge-ui-starter/webpack/bootstrap:19:1)
at Object.5944 (webpack://forge-ui-starter/node_modules/@forge/react/out/index.js:5:1)
This is my JS
import { Bank, getAllBanks } from "../utils/bank";
import {DynamicTable} from "@forge/react";
export default function BanksTable() {
const [banks, setBanks] = useState([]);
const createKey = (input) => {
return input ? input.replace(/^(the|a|an)/, "").replace(/\s/g, "") : input;
}
useEffect(() => {
const fetchData = async () => {
try {
setBanks(getAllBanks());
} catch (error) {
console.error("Error fetching data:", error);
}
};
fetchData();
}, [editActionCounter]);
const rows = banks.map((banksRow, index) => ({
key: `row-${index}-${banksRow.value.name}`,
cells: [
{
key: createKey(banksRow.value.name),
content: <Link href="">{banksRow.name}</Link>,
},
{
key: createKey("contratedHours"),
content: banksRow.value.contratedHours == 1000000 ? "∞" : banksRow.value.contratedHours,
},
],
}));
const head = {
cells: [
{
key: "name",
content: "Name",
isSortable: true,
},
{
key: "Contrated Hours",
content: "Contrated Hours",
isSortable: false,
},
],
};
return (
<DynamicTable
rowsPerPage={5}
head={head}
rows={rows}
/>
);
}