Skip to content

Starlette backend does not appear to be working #1948

Closed

Description

@limx0

Bug Report

I'm trying to migrate some custom FastAPI code over to the new perspective Starlette backend, but am not seeing any data updates or any evidence of the tables in a simple html frontend.

Steps to Reproduce:

  1. Run the example starlette backend
  2. Create a simple perspective JS frontend:
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
        <script src="https://cdn.jsdelivr.net/npm/@finos/perspective"></script>
        <script src="https://cdn.jsdelivr.net/npm/@finos/perspective-viewer"></script>
        <script src="https://cdn.jsdelivr.net/npm/@finos/perspective-viewer-datagrid"></script>
        <script src="https://cdn.jsdelivr.net/npm/@finos/perspective-viewer-d3fc"></script>
</head>
<body>
    <script>
      window.addEventListener("DOMContentLoaded", async function () {
        const websocket = perspective.websocket("ws://localhost:8080/websocket");
        const table = await websocket.open_table("data_source_one");
        const viewer = document.getElementById("viewer");
        await viewer.load(table);
      });
    </script>
    <perspective-viewer id="viewer"></perspective-viewer>
</body>
</html>

Expected Result:

Can see datagrid with data in browser

Actual Result:

Empty datagrid without any schema, no exceptions.

Environment:

Backend

  • perspective-python==1.6.3
  • fastapi==0.79.1
  • starlette==0.19.1

Frontend:

  • CDN

Additional Context:

I can see the websocket connection being established, and data in the backend. The frontend js code connects to the socket and seemingly loads the table, but the viewer does not update.

Activity

  1. timkpaine commented on Aug 27, 2022

    @timkpaine
    Member

    I don't see any issues on latest release other than that the perspective-viewer element is 0 sized. modifying your index.html to add:

            <style>
                perspective-viewer {
                    position: absolute;
                    top: 0;
                    bottom: 0;
                    left: 0;
                    right: 0;
                }
            </style>
    

    and I see everything working as normal. do you see the same?

  2. locked and limited conversation to collaborators on Aug 27, 2022
  3. converted this issue into a discussion #1957 on Aug 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions