Skip to content

Commit

Permalink
Merge pull request #21 from Point72/tkp/fetchfix
Browse files Browse the repository at this point in the history
Fix bug with fetching inside table mounting
  • Loading branch information
timkpaine committed Jun 14, 2024
2 parents 3b49182 + 4f4f900 commit ff280b5
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions js/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,13 @@ window.addEventListener("load", async () => {
tables.map(async (tableName) => {
if (registeredTables.has(tableName)) return;
registeredTables.add(tableName);
fetch("static/layouts/default.json")
.then((response) => response.json())
.then((data) => {
console.log("Loading layout from static/layouts/default.json...");
workspace.restore(data);
})
.catch((error) => {
console.error("ERROR:", error);
});
workspace.addTable(tableName, websocket.open_table(tableName));
});

const layouts = await fetch("static/layouts/default.json");
const layoutData = await layouts.json();
console.log("Loading layout from static/layouts/default.json...");
workspace.restore(layoutData);
};

await updateTables();
Expand Down

0 comments on commit ff280b5

Please sign in to comment.