Skip to content

Commit 2b44799

Browse files
authored
Merge pull request #142 from Point72/tkp/cs
Switch to perspective client/server mode to move compute to browser
2 parents 0e51e1e + ba63312 commit 2b44799

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

js/src/components/perspective/tables.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ const perspective_init_promise = Promise.all([
1515

1616
export const fetchTables = async () => {
1717
await perspective_init_promise;
18+
const worker = await perspective.worker();
1819
const protocol = window.location.protocol === "https:" ? "wss:" : "ws:";
1920
const websocket = await perspective.websocket(
2021
`${protocol}//${window.location.host}/api/v1/perspective`,
@@ -23,9 +24,13 @@ export const fetchTables = async () => {
2324
const response = await fetch("/api/v1/perspective/tables");
2425
const schemas = await response.json();
2526
const table_names = [...Object.keys(schemas)];
26-
const tables = await Promise.all(
27+
const table_handles = await Promise.all(
2728
table_names.map((table_name) => websocket.open_table(table_name)),
2829
);
30+
const views = await Promise.all(
31+
table_handles.map((table_handle) => table_handle.view()),
32+
);
33+
const tables = await Promise.all(views.map((view) => worker.table(view)));
2934
const new_tables = {};
3035
table_names.forEach((table_name, index) => {
3136
new_tables[table_name] = {

0 commit comments

Comments
 (0)