diff --git a/plugins/ui/src/deephaven/ui/object_types/ElementMessageStream.py b/plugins/ui/src/deephaven/ui/object_types/ElementMessageStream.py index 597385fb1..f3d0fa3c2 100644 --- a/plugins/ui/src/deephaven/ui/object_types/ElementMessageStream.py +++ b/plugins/ui/src/deephaven/ui/object_types/ElementMessageStream.py @@ -163,7 +163,7 @@ def _render(self) -> None: # Send the error to the client for displaying to the user # If there's an error sending it to the client, then it will be caught by the render exception handler # and logged as an error message. - # Just log it as debug here. + # Just log it as debug here so we don't show it in the console and in the error panel. stack_trace = traceback.format_exc() logging.debug("Error rendering document: %s %s", repr(e), stack_trace) self._send_document_error(e, stack_trace) @@ -199,6 +199,8 @@ def _process_callable_queue(self) -> None: self._render_state = _RenderState.IDLE except Exception as e: # Something catastrophic happened, log it and close the connection + # We're just being safe to make sure there is an error logged if something unexpected does occur, + # as `submit_task` does not log any uncaught exceptions currently: https://github.com/deephaven/deephaven-core/issues/5192 logger.exception(e) self._connection.on_close() @@ -369,6 +371,7 @@ def _send_document_error(self, error: Exception, stack_trace: str) -> None: Args: error: The error that occurred + stack_trace: The stack trace of the error """ request = self._make_notification( "documentError", diff --git a/plugins/ui/src/js/src/DashboardPlugin.tsx b/plugins/ui/src/js/src/DashboardPlugin.tsx index f37f0450d..3e9381d13 100644 --- a/plugins/ui/src/js/src/DashboardPlugin.tsx +++ b/plugins/ui/src/js/src/DashboardPlugin.tsx @@ -94,7 +94,7 @@ export function DashboardPlugin( widgetId: string; widget: WidgetDescriptor; }) => { - log.info('Opening widget with ID', widgetId, widget); + log.debug('Opening widget with ID', widgetId, widget); setWidgetMap(prevWidgetMap => { const newWidgetMap = new Map(prevWidgetMap); const oldWidget = newWidgetMap.get(widgetId); @@ -213,7 +213,7 @@ export function DashboardPlugin( ); const handleWidgetClose = useCallback((widgetId: string) => { - log.info('handleWidgetClose', widgetId); + log.debug('handleWidgetClose', widgetId); setWidgetMap(prevWidgetMap => { const newWidgetMap = new Map(prevWidgetMap); newWidgetMap.delete(widgetId); diff --git a/plugins/ui/src/js/src/styles.scss b/plugins/ui/src/js/src/styles.scss index fc690d2dc..2441a0f5f 100644 --- a/plugins/ui/src/js/src/styles.scss +++ b/plugins/ui/src/js/src/styles.scss @@ -57,7 +57,7 @@ // TODO: Remove once using the @deephaven/components ErrorView: https://github.com/deephaven/web-client-ui/pull/1965 .ui-error-view { position: relative; - color: $danger; + color: var(--dh-color-negative-bg); border-radius: $border-radius; background-color: negative-opacity($exception-transparency); display: flex; @@ -133,7 +133,7 @@ width: 100%; padding: $spacer; margin-bottom: 0; - color: $danger; + color: var(--dh-color-negative-bg); background-color: transparent; border: 0; resize: none; diff --git a/plugins/ui/src/js/src/widget/DocumentHandler.tsx b/plugins/ui/src/js/src/widget/DocumentHandler.tsx index 0b55e29ba..9d947b9f3 100644 --- a/plugins/ui/src/js/src/widget/DocumentHandler.tsx +++ b/plugins/ui/src/js/src/widget/DocumentHandler.tsx @@ -52,9 +52,14 @@ function DocumentHandler({ onClose, }: DocumentHandlerProps): JSX.Element { log.debug('Rendering document', widget); + // We want to know if we're in the middle of an update, so we don't send a close event if we're in the middle of an update + // We set this as the first thing of this function, then set it to false at the end in a `useEffect` so it gets set after everything else + // is done in the render cycle. + const isUpdating = useRef(true); + isUpdating.current = true; + const panelOpenCountRef = useRef(0); const panelIdIndex = useRef(0); - const isUpdating = useRef(false); // Using `useState` here to initialize the data only once. // We don't want to use `useMemo`, because we only want it to be initialized once with the `initialData` (uncontrolled) @@ -125,8 +130,8 @@ function DocumentHandler({ [widget, getPanelId, handleClose, handleOpen] ); - isUpdating.current = true; useEffect(() => { + // Reset the updating flag after everything else is done isUpdating.current = false; }); diff --git a/plugins/ui/src/js/src/widget/WidgetErrorView.tsx b/plugins/ui/src/js/src/widget/WidgetErrorView.tsx index 1cb0e9e87..8752f9778 100644 --- a/plugins/ui/src/js/src/widget/WidgetErrorView.tsx +++ b/plugins/ui/src/js/src/widget/WidgetErrorView.tsx @@ -1,5 +1,6 @@ import React from 'react'; import { Button } from '@deephaven/components'; +import { vsRefresh } from '@deephaven/icons'; import ErrorView from './ErrorView'; import { WidgetError } from './WidgetTypes'; @@ -11,14 +12,16 @@ function WidgetErrorView({ error: WidgetError; onReload: () => void; }): JSX.Element { - const displayMessage = `${error.message}\n\n${error.stack ?? ''}`.trim(); + const displayMessage = `${error.message.trim()}\n\n${ + error.stack ?? '' + }`.trim(); return (