Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minified React Error #31 #998

Open
chipkent opened this issue Nov 7, 2024 · 6 comments
Open

Minified React Error #31 #998

chipkent opened this issue Nov 7, 2024 · 6 comments
Labels
bug Something isn't working
Milestone

Comments

@chipkent
Copy link
Member

chipkent commented Nov 7, 2024

image
[ErrorBoundary] Error caught by ErrorBoundary Error: Minified React error #31; visit https://reactjs.org/docs/error-decoder.html?invariant=31&args[]=object%20with%20keys%20%7Bconnection%2C%20ticket_0%2C%20fetched%7D for the full message or use the non-minified dev environment for full errors and additional helpful warnings.
    at Ax (react-dom.production.min.js:140:47)
    at react-dom.production.min.js:150:265
    at Zs (react-dom.production.min.js:176:186)
    at SP (react-dom.production.min.js:187:274)
    at zde (react-dom.production.min.js:186:173)
    at t5e (react-dom.production.min.js:269:427)
    at X2e (react-dom.production.min.js:250:347)
    at YQe (react-dom.production.min.js:250:278)
    at Ey (react-dom.production.min.js:250:138)
    at NP (react-dom.production.min.js:243:163)
    at react-dom.production.min.js:123:115
    at e.unstable_runWithPriority (scheduler.production.min.js:18:343)
    at Rv (react-dom.production.min.js:122:325)
    at D2e (react-dom.production.min.js:123:61)
    at ip (react-dom.production.min.js:122:428)
    at mm (react-dom.production.min.js:237:203)
    at $ue (react-dom.production.min.js:170:408)
    at eval (eval at <anonymous> (loadRemoteModule.js:21:24), <anonymous>:11227:11)
    at eval (eval at <anonymous> (loadRemoteModule.js:21:24), <anonymous>:7063:24)
    at callMethod (eval at <anonymous> (loadRemoteModule.js:21:24), <anonymous>:7167:18)
    at noopMiddleware (eval at <anonymous> (loadRemoteModule.js:21:24), <anonymous>:7199:10)
    at JSONRPCServer2.callMethod (eval at <anonymous> (loadRemoteModule.js:21:24), <anonymous>:7179:51)
    at JSONRPCServer2.eval (eval at <anonymous> (loadRemoteModule.js:21:24), <anonymous>:7128:31)
    at step (eval at <anonymous> (loadRemoteModule.js:21:24), <anonymous>:7006:17)
    at Object.eval [as next] (eval at <anonymous> (loadRemoteModule.js:21:24), <anonymous>:6958:14)
    at eval (eval at <anonymous> (loadRemoteModule.js:21:24), <anonymous>:6945:67)
    at new Promise (<anonymous>)
    at __awaiter$1 (eval at <anonymous> (loadRemoteModule.js:21:24), <anonymous>:6927:10)
    at JSONRPCServer2.receiveSingle (eval at <anonymous> (loadRemoteModule.js:21:24), <anonymous>:7119:14)
    at JSONRPCServer2.receive (eval at <anonymous> (loadRemoteModule.js:21:24), <anonymous>:7092:21)
    at JSONRPCServerAndClient2.eval (eval at <anonymous> (loadRemoteModule.js:21:24), <anonymous>:7386:38)
    at step (eval at <anonymous> (loadRemoteModule.js:21:24), <anonymous>:7314:17)
    at Object.eval [as next] (eval at <anonymous> (loadRemoteModule.js:21:24), <anonymous>:7266:14)
    at eval (eval at <anonymous> (loadRemoteModule.js:21:24), <anonymous>:7253:67)
    at new Promise (<anonymous>)
    at __awaiter (eval at <anonymous> (loadRemoteModule.js:21:24), <anonymous>:7235:10)
    at JSONRPCServerAndClient2.receiveAndSend (eval at <anonymous> (loadRemoteModule.js:21:24), <anonymous>:7376:14)
    at receiveData (eval at <anonymous> (loadRemoteModule.js:21:24), <anonymous>:11270:32)
    at eval (eval at <anonymous> (loadRemoteModule.js:21:24), <anonymous>:11282:11)
    at Object.$lambda$3 (dh-core.js:5399:5)
    at Function.onInvoke_9 (dh-core.js:6066:16)
    at lambda (dh-core.js:174:22)
    at Array.forEach (<anonymous>)
    at Object.$fireEvent_0 (dh-core.js:5375:15)
    at Object.$lambda$6_4 (dh-core.js:25658:11)
    at Function.apply_167 (dh-core.js:25885:10)
    at lambda (dh-core.js:174:22)
    at dh-internal.js:1:792286
    at Array.forEach (<anonymous>)
    at dh-internal.js:1:792265
    at dh-internal.js:1:43529
    at Array.forEach (<anonymous>)
    at e.rawOnMessage (dh-internal.js:1:43491)
    at dh-internal.js:1:41304
    at Array.forEach (<anonymous>)
    at e.onTransportChunk (dh-internal.js:1:41179)
    at Object.$onMessage (dh-core.js:17888:35)
    at MultiplexedWebsocketTransport$3methodref$onMessage$Type.handleEvent_2 [as handleEvent] (dh-core.js:18032:10) Object
@chipkent chipkent added bug Something isn't working triage labels Nov 7, 2024
@chipkent
Copy link
Member Author

chipkent commented Nov 7, 2024

# TODO: pydoc
import logging
from typing import Tuple, Callable, Any
from deephaven import ui, dtypes
from deephaven.table import Table, PartitionedTable
from deephaven.plot.figure import Figure


# This function is to avoid UI bugs in rendering tables with non-primitive columns
# TODO: https://github.com/deephaven/deephaven-plugins/issues/701
# TODO: https://github.com/deephaven/deephaven-core/issues/5708
def _retain_primitive_cols(name: str, table: Table) -> Table:
    """Return a new table with only primitive columns.

    This function is to avoid UI bugs in rendering tables with non-primitive columns.

    Args:
        name (str): The name of the table.
        table (Table): The table to filter.
    """
    def retain_col(col):
        retain = col.data_type.is_primitive or col.data_type in [dtypes.string, dtypes.bool_, dtypes.Instant]

        if not retain:
            logging.warning(f"REMOVING COLUMN FOR VISUALIZATION: table={name} column={col.name} type={col.data_type}.")

        return retain

    return table.view([col.name for col in table.columns if retain_col(col)])


def null_note(t: Table, note: str, func: Callable[[], Any]) -> Any:
    """ Return a note if the table is empty; otherwise, return the element from the function. """
    return func() if t else ui.text(note)


# TODO: this is commented out because it fails if it is not
# @ui.component
def _symbol_picker(table: PartitionedTable, label: str = "Symbol") -> Tuple[ui.Element, str]:
    symbol_table = ui.use_memo(lambda: table.table.view("symbol").select_distinct().sort("symbol"), [])
    symbol, set_symbol = ui.use_state("")

    pick_table = ui.picker(
        symbol_table,
        label=label,
        on_change=set_symbol,
        selected_key=symbol,
    )

    text = ui.text_field(
        value=symbol,
        on_change=set_symbol,
        label=label,
    )

    return ui.flex(pick_table, text), symbol


@ui.component
def _tab_table_view(tables: dict[str, PartitionedTable], symbol: str) -> ui.BaseElement:

    def make_component(table):
        t = table.get_constituent([symbol])
        return null_note(t, f"No data for {symbol}", lambda: t)

    return ui.stack([ui.panel(make_component(table), title=name) for name, table in tables.items()])


@ui.component
def plot_shares(shares: Table) -> Figure:
    p = Figure()

    for col in shares.columns:
        if "shares_" in col.name and "dilution_factor" not in col.name:
            p = p.plot_xy(col.name, shares, x="timestamp", y=col.name)

    return p.show()

@ui.component
def plot_prices(prices: Table) -> Figure:
    return (
        Figure()
        .plot_xy("close_split_div_adj", prices, x="timestamp", y="close_split_div_adj")
        .y_axis(log=True)
        .show()
    )

@ui.component
def plot_fundamentals(fundamentals: Table, series: str):
    return (
        Figure()
        .plot_xy(series, fundamentals, x="timestamp", y=series)
        .show()
    )


@ui.component
def plot_model_preds(model_preds: Table, symbol: str) -> Figure:

    if model_preds.size == 0:
        return ui.text(f"No model predictions for {symbol}")

    model_preds = model_preds.update_view([
                "pred_price_sdp = pred_price + pred_price_stdev_uncorr",  # TODO: which stdev?
                "pred_price_sdm = pred_price - pred_price_stdev_uncorr",  # TODO: which stdev?
            ])

    return (
        Figure()
        .plot_xy("Pred", t=model_preds, x="pred_time", y="pred_price",
                      y_low="pred_price_sdm", y_high="pred_price_sdp", by=["full_name"])
        .y_axis(log=True)
    )


@ui.component
def plot_meta_preds(meta_preds: Table, symbol: str) -> Figure:

    if meta_preds.size == 0:
        return ui.text(f"No meta predictions for {symbol}")

    meta = (
        meta_preds
        .update_view([
            "full_name = stdev_calc + `_` + meta_weights_func",
            "pred_price_sdp = pred_price + pred_price_stdev",
            "pred_price_sdm = pred_price - pred_price_stdev",
        ])
    )

    #TODO: DEBUG
    mx = meta.select_distinct("full_name")
    # print("META FULL NAME", mx)
    for v in mx.iter_tuple("full_name"):
        print("META FULL NAME", v)

    p = Figure()

    p = p.plot_xy("Meta", t=meta, x="pred_time", y="pred_price", y_low="pred_price_sdm", y_high="pred_price_sdp", by=["full_name"])

    p = p.y_axis(log=True)
    return p.show()


@ui.component
def _input_plots(tables: dict[str, PartitionedTable], symbol: str) -> ui.BaseElement:

    # TODO: this doesn't work --> need to have calls to the same number of hooks
    # if not symbol:
    #     return ui.panel(ui.text("Select a symbol"))

    # TODO: filter on date

    shares = tables["shares"].get_constituent([symbol])
    prices = tables["prices"].get_constituent([symbol])
    fundamentals = tables["fundamentals"].get_constituent([symbol])
    model_preds = tables["model_preds"].get_constituent([symbol])
    meta_preds = tables["meta_preds"].get_constituent([symbol])

    error_msg = f"No data for {symbol}"
    outputs = []

    outputs.append(ui.panel(null_note(shares, error_msg, lambda: plot_shares(shares)), title="shares"))
    outputs.append(ui.panel(null_note(prices, error_msg, lambda: plot_prices(prices)), title="prices"))

    for col in tables["fundamentals"].constituent_table_columns:
        if col.name in ["date", "timestamp", "symbol"]:
            continue

        outputs.append(ui.panel(null_note(fundamentals, error_msg, lambda: plot_fundamentals(fundamentals, col.name)), title=col.name))

    outputs.append(ui.panel(null_note(model_preds, error_msg, lambda: plot_model_preds(model_preds.where("active"), symbol)), title="model_preds_active"))
    outputs.append(ui.panel(null_note(model_preds, error_msg, lambda: plot_model_preds(model_preds.where("!active"), symbol)), title="model_preds_inactive"))
    outputs.append(ui.panel(null_note(meta_preds, error_msg, lambda: plot_meta_preds(meta_preds, symbol)), title="meta_preds"))

    return ui.stack(
        *outputs,
    )


@ui.component
def my_panel(tables: dict[str, PartitionedTable]) -> ui.BaseElement:
    model_preds = tables["model_preds"]
    symbol_picker, symbol = _symbol_picker(model_preds, label="Symbol")

    # TODO: thinks this should be fine --> Doesn't work because new stuff is garbage at the bottom
    # if not symbol:
    #     return ui.column(symbol_picker)

    ttv = _tab_table_view(tables, symbol)
    ip = _input_plots(tables, symbol)

    return ui.column(
        symbol_picker,
        ttv,
        ip,
    )


def my_dashboard(tables: dict[str, Table]) -> ui.DashboardElement:
    part_tables = {name: _retain_primitive_cols(name, table).partition_by("symbol") for name, table in tables.items()}
    return ui.dashboard(my_panel(part_tables)) # TODO: Bad type hint or should fail

if __name__ == "__main__":
    from cecropia.lynchmunger import cli
    globals().update(cli.debug_values)
    dashboard = my_dashboard(cli.debug_values)

@chipkent
Copy link
Member Author

chipkent commented Nov 7, 2024

Uncaught (in promise) InvalidStateError: Failed to update a ServiceWorker for scope ('http://localhost:8080/ide/download/') with script ('Unknown'): The object is in an invalid state.

@chipkent
Copy link
Member Author

chipkent commented Nov 7, 2024

LogProxy.js:87 [ErrorBoundary] Error caught by ErrorBoundary Error: Minified React error #31; visit https://reactjs.org/docs/error-decoder.html?invariant=31&args[]=object%20with%20keys%20%7Bconnection%2C%20ticket_0%2C%20fetched%7D for the full message or use the non-minified dev environment for full errors and additional helpful warnings.
    at Ax (react-dom.production.min.js:140:47)
    at react-dom.production.min.js:150:265
    at Zs (react-dom.production.min.js:176:186)
    at SP (react-dom.production.min.js:187:274)
    at zde (react-dom.production.min.js:186:173)
    at t5e (react-dom.production.min.js:269:427)
    at X2e (react-dom.production.min.js:250:347)
    at YQe (react-dom.production.min.js:250:278)
    at Ey (react-dom.production.min.js:250:138)
    at NP (react-dom.production.min.js:243:163)
    at react-dom.production.min.js:123:115
    at e.unstable_runWithPriority (scheduler.production.min.js:18:343)
    at Rv (react-dom.production.min.js:122:325)
    at D2e (react-dom.production.min.js:123:61)
    at ip (react-dom.production.min.js:122:428)
    at mm (react-dom.production.min.js:237:203)
    at $ue (react-dom.production.min.js:170:408)
    at eval (eval at <anonymous> (loadRemoteModule.js:21:24), <anonymous>:11227:11)
    at eval (eval at <anonymous> (loadRemoteModule.js:21:24), <anonymous>:7063:24)
    at callMethod (eval at <anonymous> (loadRemoteModule.js:21:24), <anonymous>:7167:18)
    at noopMiddleware (eval at <anonymous> (loadRemoteModule.js:21:24), <anonymous>:7199:10)
    at JSONRPCServer2.callMethod (eval at <anonymous> (loadRemoteModule.js:21:24), <anonymous>:7179:51)
    at JSONRPCServer2.eval (eval at <anonymous> (loadRemoteModule.js:21:24), <anonymous>:7128:31)
    at step (eval at <anonymous> (loadRemoteModule.js:21:24), <anonymous>:7006:17)
    at Object.eval [as next] (eval at <anonymous> (loadRemoteModule.js:21:24), <anonymous>:6958:14)
    at eval (eval at <anonymous> (loadRemoteModule.js:21:24), <anonymous>:6945:67)
    at new Promise (<anonymous>)
    at __awaiter$1 (eval at <anonymous> (loadRemoteModule.js:21:24), <anonymous>:6927:10)
    at JSONRPCServer2.receiveSingle (eval at <anonymous> (loadRemoteModule.js:21:24), <anonymous>:7119:14)
    at JSONRPCServer2.receive (eval at <anonymous> (loadRemoteModule.js:21:24), <anonymous>:7092:21)
    at JSONRPCServerAndClient2.eval (eval at <anonymous> (loadRemoteModule.js:21:24), <anonymous>:7386:38)
    at step (eval at <anonymous> (loadRemoteModule.js:21:24), <anonymous>:7314:17)
    at Object.eval [as next] (eval at <anonymous> (loadRemoteModule.js:21:24), <anonymous>:7266:14)
    at eval (eval at <anonymous> (loadRemoteModule.js:21:24), <anonymous>:7253:67)
    at new Promise (<anonymous>)
    at __awaiter (eval at <anonymous> (loadRemoteModule.js:21:24), <anonymous>:7235:10)
    at JSONRPCServerAndClient2.receiveAndSend (eval at <anonymous> (loadRemoteModule.js:21:24), <anonymous>:7376:14)
    at receiveData (eval at <anonymous> (loadRemoteModule.js:21:24), <anonymous>:11270:32)
    at eval (eval at <anonymous> (loadRemoteModule.js:21:24), <anonymous>:11282:11)
    at Object.$lambda$3 (dh-core.js:5399:5)
    at Function.onInvoke_9 (dh-core.js:6066:16)
    at lambda (dh-core.js:174:22)
    at Array.forEach (<anonymous>)
    at Object.$fireEvent_0 (dh-core.js:5375:15)
    at Object.$lambda$6_4 (dh-core.js:25658:11)
    at Function.apply_167 (dh-core.js:25885:10)
    at lambda (dh-core.js:174:22)
    at dh-internal.js:1:792286
    at Array.forEach (<anonymous>)
    at dh-internal.js:1:792265
    at dh-internal.js:1:43529
    at Array.forEach (<anonymous>)
    at e.rawOnMessage (dh-internal.js:1:43491)
    at dh-internal.js:1:41304
    at Array.forEach (<anonymous>)
    at e.onTransportChunk (dh-internal.js:1:41179)
    at Object.$onMessage (dh-core.js:17888:35)
    at MultiplexedWebsocketTransport$3methodref$onMessage$Type.handleEvent_2 [as handleEvent] (dh-core.js:18032:10) 
{componentStack: '\n    at ReactPanelErrorBoundary (eval at <anonymou…alhost:8080/ide/assets/index-31948f17.js:19:8866)'}
LogProxy.js:73 [DownloadServiceWorkerUtils] Registering service worker on  
URL {origin: 'http://localhost:8080', protocol: 'http:', username: '', password: '', host: 'localhost:8080', …}
 
ServiceWorkerRegistration {installing: ServiceWorker, waiting: null, active: null, navigationPreload: NavigationPreloadManager, scope: 'http://localhost:8080/ide/download/', …}

@chipkent
Copy link
Member Author

chipkent commented Nov 7, 2024

The error seems to be related to these lines. If the lines are commented out, it seems to run without errors.

    outputs.append(ui.panel(null_note(model_preds, error_msg, lambda: plot_model_preds(model_preds.where("active"), symbol)), title="model_preds_active"))
    outputs.append(ui.panel(null_note(model_preds, error_msg, lambda: plot_model_preds(model_preds.where("!active"), symbol)), title="model_preds_inactive"))

in

# TODO: pydoc
import logging
from typing import Tuple, Callable, Any
from deephaven import ui, dtypes
from deephaven.table import Table, PartitionedTable
from deephaven.plot.figure import Figure


# This function is to avoid UI bugs in rendering tables with non-primitive columns
# TODO: https://github.com/deephaven/deephaven-plugins/issues/701
# TODO: https://github.com/deephaven/deephaven-core/issues/5708
def _retain_primitive_cols(name: str, table: Table) -> Table:
    """Return a new table with only primitive columns.

    This function is to avoid UI bugs in rendering tables with non-primitive columns.

    Args:
        name (str): The name of the table.
        table (Table): The table to filter.
    """
    def retain_col(col):
        retain = col.data_type.is_primitive or col.data_type in [dtypes.string, dtypes.bool_, dtypes.Instant]

        if not retain:
            logging.warning(f"REMOVING COLUMN FOR VISUALIZATION: table={name} column={col.name} type={col.data_type}.")

        return retain

    return table.view([col.name for col in table.columns if retain_col(col)])


def null_note(t: Table, note: str, func: Callable[[], Any]) -> Any:
    """ Return a note if the table is empty; otherwise, return the element from the function. """
    return func() if t else ui.text(note)


# TODO: this is commented out because it fails if it is not
# @ui.component
def _symbol_picker(table: PartitionedTable, label: str = "Symbol") -> Tuple[ui.Element, str]:
    symbol_table = ui.use_memo(lambda: table.table.view("symbol").select_distinct().sort("symbol"), [])
    symbol, set_symbol = ui.use_state("")

    pick_table = ui.picker(
        symbol_table,
        label=label,
        on_change=set_symbol,
        selected_key=symbol,
    )

    text = ui.text_field(
        value=symbol,
        on_change=set_symbol,
        label=label,
    )

    return ui.flex(pick_table, text), symbol


@ui.component
def _tab_table_view(tables: dict[str, PartitionedTable], symbol: str) -> ui.BaseElement:

    def make_component(table):
        t = table.get_constituent([symbol])
        return null_note(t, f"No data for {symbol}", lambda: t)

    return ui.stack([ui.panel(make_component(table), title=name) for name, table in tables.items()])


@ui.component
def plot_shares(shares: Table) -> Figure:
    p = Figure()

    for col in shares.columns:
        if "shares_" in col.name and "dilution_factor" not in col.name:
            p = p.plot_xy(col.name, shares, x="timestamp", y=col.name)

    return p.show()

@ui.component
def plot_prices(prices: Table) -> Figure:
    return (
        Figure()
        .plot_xy("close_split_div_adj", prices, x="timestamp", y="close_split_div_adj")
        .y_axis(log=True)
        .show()
    )

@ui.component
def plot_fundamentals(fundamentals: Table, series: str):
    return (
        Figure()
        .plot_xy(series, fundamentals, x="timestamp", y=series)
        .show()
    )


@ui.component
def plot_model_preds(model_preds: Table, symbol: str) -> Figure:

    if model_preds.size == 0:
        return ui.text(f"No model predictions for {symbol}")

    model_preds = model_preds.update_view([
                "pred_price_sdp = pred_price + pred_price_stdev_uncorr",  # TODO: which stdev?
                "pred_price_sdm = pred_price - pred_price_stdev_uncorr",  # TODO: which stdev?
            ])

    return (
        Figure()
        .plot_xy("Pred", t=model_preds, x="pred_time", y="pred_price",
                      y_low="pred_price_sdm", y_high="pred_price_sdp", by=["full_name"])
        .y_axis(log=True)
    )


@ui.component
def plot_meta_preds(meta_preds: Table, symbol: str) -> Figure:

    if meta_preds.size == 0:
        return ui.text(f"No meta predictions for {symbol}")

    meta = (
        meta_preds
        .update_view([
            "full_name = stdev_calc + `_` + meta_weights_func",
            "pred_price_sdp = pred_price + pred_price_stdev",
            "pred_price_sdm = pred_price - pred_price_stdev",
        ])
    )

    meta = meta.where("full_name == `uncorr_equal`").select()

    #TODO: DEBUG
    mx = meta.select_distinct("full_name")
    for v in mx.iter_tuple("full_name"):
        print("META FULL NAME", v)
    for col in meta.columns:
        print("META COL", col)

    p = Figure()

    # p = p.plot_xy("Meta", t=meta, x="pred_time", y="pred_price", y_low="pred_price_sdm", y_high="pred_price_sdp", by=["full_name"])
    p = p.plot_xy("Meta", t=meta, x="pred_time", y="pred_price", y_low="pred_price_sdm", y_high="pred_price_sdp")

    p = p.y_axis(log=True)
    return p.show()


@ui.component
def _input_plots(tables: dict[str, PartitionedTable], symbol: str) -> ui.BaseElement:

    # TODO: this doesn't work --> need to have calls to the same number of hooks
    # if not symbol:
    #     return ui.panel(ui.text("Select a symbol"))

    # TODO: filter on date

    shares = tables["shares"].get_constituent([symbol])
    prices = tables["prices"].get_constituent([symbol])
    fundamentals = tables["fundamentals"].get_constituent([symbol])
    model_preds = tables["model_preds"].get_constituent([symbol])
    meta_preds = tables["meta_preds"].get_constituent([symbol])

    error_msg = f"No data for {symbol}"
    outputs = []

    outputs.append(ui.panel(null_note(shares, error_msg, lambda: plot_shares(shares)), title="shares"))
    outputs.append(ui.panel(null_note(prices, error_msg, lambda: plot_prices(prices)), title="prices"))

    for col in tables["fundamentals"].constituent_table_columns:
        if col.name in ["date", "timestamp", "symbol"]:
            continue

        outputs.append(ui.panel(null_note(fundamentals, error_msg, lambda: plot_fundamentals(fundamentals, col.name)), title=col.name))

    outputs.append(ui.panel(null_note(model_preds, error_msg, lambda: plot_model_preds(model_preds.where("active"), symbol)), title="model_preds_active"))
    outputs.append(ui.panel(null_note(model_preds, error_msg, lambda: plot_model_preds(model_preds.where("!active"), symbol)), title="model_preds_inactive"))
    outputs.append(ui.panel(null_note(meta_preds, error_msg, lambda: plot_meta_preds(meta_preds, symbol)), title="meta_preds"))

    return ui.stack(
        *outputs,
    )


@ui.component
def my_panel(tables: dict[str, PartitionedTable]) -> ui.BaseElement:
    model_preds = tables["model_preds"]
    symbol_picker, symbol = _symbol_picker(model_preds, label="Symbol")

    # TODO: thinks this should be fine --> Doesn't work because new stuff is garbage at the bottom
    # if not symbol:
    #     return ui.column(symbol_picker)

    ttv = _tab_table_view(tables, symbol)
    ip = _input_plots(tables, symbol)

    return ui.column(
        symbol_picker,
        ttv,
        ip,
    )


def my_dashboard(tables: dict[str, Table]) -> ui.DashboardElement:
    part_tables = {name: _retain_primitive_cols(name, table).partition_by("symbol") for name, table in tables.items()}
    return ui.dashboard(my_panel(part_tables)) # TODO: Bad type hint or should fail

if __name__ == "__main__":
    from cecropia.lynchmunger import cli
    globals().update(cli.debug_values)
    dashboard = my_dashboard(cli.debug_values)

@chipkent
Copy link
Member Author

chipkent commented Nov 7, 2024

If you set model_preds = None just before the two noted lines, it also runs without error.

@chipkent
Copy link
Member Author

chipkent commented Nov 7, 2024

I have found the problem. On line 122, the plot generation is missing .show(). That resulted in this totally understandable cryptic error that I have been chasing for 1 hr+.

See #997

@vbabich vbabich added this to the November 2024 milestone Nov 12, 2024
@vbabich vbabich removed the triage label Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants