Skip to content

Perspective JupyterLab plugin cannot be used with other plugins that use perspective #3056

@timkpaine

Description

@timkpaine

Due to the initialization of custom components:

Image

This causes the jupyter widget initialization to fail, which results in it not being displayable:

Image

This appears to be unavoidable as an import of @finos/perspective-viewer is now required, so it is not an option to not import perspective:

import perspective from "@finos/perspective";
// triggers component registration
import perspective_viewer from "@finos/perspective-viewer";
import SERVER_WASM from "@finos/perspective/dist/wasm/perspective-server.wasm";
import CLIENT_WASM from "@finos/perspective-viewer/dist/wasm/perspective-viewer.wasm";

// Required, otherwise perspective.table will not work
await Promise.all([perspective.init_server(fetch(SERVER_WASM)), perspective_viewer.init_client(fetch(CLIENT_WASM))]);

To get my extension working, I was able to make the following change in the minified assets, which shows the problematic parts:

Image

problem 1: https://github.com/finos/perspective/blob/a074bed2908964fbbb09f301d4a1b7157581c3c0/rust/perspective-viewer/src/rust/utils/custom_element.rs#L70
problem 2: https://github.com/finos/perspective/blob/a074bed2908964fbbb09f301d4a1b7157581c3c0/packages/perspective-viewer-datagrid/src/js/index.js#L38
problem 3:
https://github.com/finos/perspective/blob/a074bed2908964fbbb09f301d4a1b7157581c3c0/packages/perspective-viewer-d3fc/src/ts/plugin/plugin.ts#L88

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions