@tutti-os/workbench-surface 0.0.63 → 0.0.64

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -669,6 +669,10 @@ interface WorkbenchHostNodeDefinition<TExternalNodeState = unknown, TExternalWor
669
669
  frame: WorkbenchFrame;
670
670
  getWindowCloseEffect?: WorkbenchHostWindowCloseEffectResolver<TExternalNodeState, TExternalWorkspaceState>;
671
671
  instance?: WorkbenchHostNodeInstanceStrategy;
672
+ onBodyRenderErrorChange?: (input: {
673
+ hasError: boolean;
674
+ node: WorkbenchNode<WorkbenchHostNodeData>;
675
+ }) => void;
672
676
  renderBody: WorkbenchHostBodyRenderer<TExternalNodeState, TExternalWorkspaceState>;
673
677
  renderHeader?: WorkbenchHostHeaderRenderer<TExternalNodeState, TExternalWorkspaceState>;
674
678
  sizeConstraints?: WorkbenchNodeSizeConstraints | null;
package/dist/index.js CHANGED
@@ -12772,6 +12772,10 @@ function useWorkbenchHostSurfaceRenderers(input) {
12772
12772
  {
12773
12773
  debugDiagnostics: input.debugDiagnostics,
12774
12774
  node: context.node,
12775
+ onErrorChange: (hasError) => definition.onBodyRenderErrorChange?.({
12776
+ hasError,
12777
+ node: context.node
12778
+ }),
12775
12779
  resetKey: `${context.node.id}:${context.node.data.typeId}:${input.externalStateRevision}`,
12776
12780
  workspaceId: input.workspaceId,
12777
12781
  children: /* @__PURE__ */ jsx13(
@@ -13008,9 +13012,16 @@ var WorkbenchHostNodeRenderErrorBoundary = class extends Component {
13008
13012
  componentDidUpdate(previousProps) {
13009
13013
  if (this.state.hasError && previousProps.resetKey !== this.props.resetKey) {
13010
13014
  this.setState({ hasError: false });
13015
+ this.props.onErrorChange?.(false);
13016
+ }
13017
+ }
13018
+ componentWillUnmount() {
13019
+ if (this.state.hasError) {
13020
+ this.props.onErrorChange?.(false);
13011
13021
  }
13012
13022
  }
13013
13023
  componentDidCatch(error, info) {
13024
+ this.props.onErrorChange?.(true);
13014
13025
  try {
13015
13026
  const result = this.props.debugDiagnostics?.log?.({
13016
13027
  details: {
@@ -13074,7 +13085,10 @@ var WorkbenchHostNodeRenderErrorBoundary = class extends Component {
13074
13085
  "button",
13075
13086
  {
13076
13087
  type: "button",
13077
- onClick: () => this.setState({ hasError: false }),
13088
+ onClick: () => {
13089
+ this.setState({ hasError: false });
13090
+ this.props.onErrorChange?.(false);
13091
+ },
13078
13092
  style: {
13079
13093
  border: "1px solid var(--line-2, #d1d5db)",
13080
13094
  borderRadius: 6,