deephaven / deephaven-core

Deephaven Community Core
Other
258 stars 80 forks source link

Can't switch between tabs that contain dx plots #6447

Closed mofojed closed 7 minutes ago

mofojed commented 19 hours ago

Description

If your tabs contain dx plots, when you try and switch between them it throws an error.

Steps to reproduce

  1. Run the following:
    
    from deephaven import empty_table, ui
    from deephaven.plot import express as dx

_sin = empty_table(100).update(["x=i", "y=Math.sin(i)"]) _cos = empty_table(100).update(["x=i", "y=Math.cos(i)"])

trigs = ui.tabs( ui.tab(_sin, dx.line(_sin, "x", "y"), title="Sin"), ui.tab(_cos, dx.line(_cos, "x", "y"), title="Cos"), )

2. Switch between the Sin/Cos tabs

**Expected results**
2. Should be able to switch between tabs without error

**Actual results**
2. There is an error thrown when switching tabs:

TypeError

_b.close is not a function

TypeError: _b.close is not a function at _PlotlyExpressChartModel.removeTable (eval at (http://localhost:10000/ide/assets/vendor-uUWsOC0P.js:992:34160), :86071:68) at eval (eval at (http://localhost:10000/ide/assets/vendor-uUWsOC0P.js:992:34160), :85802:52) at Map.forEach () at _PlotlyExpressChartModel.unsubscribe (eval at (http://localhost:10000/ide/assets/vendor-uUWsOC0P.js:992:34160), :85802:28) at g.unsubscribe (http://localhost:10000/ide/assets/Chart-BRoqp4Ye.js:1:5882) at g.componentWillUnmount (http://localhost:10000/ide/assets/Chart-BRoqp4Ye.js:1:5307) at Qpe (http://localhost:10000/ide/assets/vendor-uUWsOC0P.js:39:3481) at G5e (http://localhost:10000/ide/assets/vendor-uUWsOC0P.js:39:5337) at $et (http://localhost:10000/ide/assets/vendor-uUWsOC0P.js:41:3881) at e.unstable_runWithPriority (http://localhost:10000/ide/assets/vendor-uUWsOC0P.js:26:3824) at ag (http://localhost:10000/ide/assets/vendor-uUWsOC0P.js:37:38797) at vv (http://localhost:10000/ide/assets/vendor-uUWsOC0P.js:41:1836) at gF (http://localhost:10000/ide/assets/vendor-uUWsOC0P.js:39:11114) at http://localhost:10000/ide/assets/vendor-uUWsOC0P.js:37:39024 at e.unstable_runWithPriority (http://localhost:10000/ide/assets/vendor-uUWsOC0P.js:26:3824) at ag (http://localhost:10000/ide/assets/vendor-uUWsOC0P.js:37:38797) at C5e (http://localhost:10000/ide/assets/vendor-uUWsOC0P.js:37:38970) at Tp (http://localhost:10000/ide/assets/vendor-uUWsOC0P.js:37:38903) at K2e (http://localhost:10000/ide/assets/vendor-uUWsOC0P.js:41:18391) at fJe (http://localhost:10000/ide/assets/vendor-uUWsOC0P.js:37:17687)



**Additional details and attachments**

<img width="791" alt="image" src="https://github.com/user-attachments/assets/4fff39d2-b139-482c-b792-54d6303d160e">

**Versions**

Engine Version: 0.37.0
Web UI Version: 0.99.0
Java Version: 17.0.12
Groovy Version: Unknown
Barrage Version: 0.7.2
Browser Name: Chrome 131
User Agent OS: macOS 10.15.7
@deephaven/js-plugin-plotly-express: 0.12.0
@deephaven/js-plugin-ui: 0.23.1
mofojed commented 19 hours ago

Investigating the issue, it looks like we try to close the TableSubscription, but that doesn't have a .close() method exposed anymore:

image

TableSubscription used to have a close() method, seems it was removed (inadvertently?) with the JS API refactor: https://github.com/deephaven/deephaven-core/pull/5890/files#diff-2549129f59ef633fee2fa8847e45372ca5d2c137b6cf679973f6823f2a5742d2

It looks like it's on AbstractTableSubscription, but that doesn't seem to be exposed from the subclass in JS.