private stateChanged()

in packages/app/client/src/ui/editor/emulator/parts/inspector/inspector.tsx [293:321]


  private stateChanged(newState: InspectorState, oldState: InspectorState): void {
    if (!this.canInspect) {
      return;
    }

    if (oldState.botHash !== newState.botHash) {
      this.botUpdated(newState.activeBot);
    }

    if (oldState.inspectorSrc !== newState.inspectorSrc || oldState.containerRef !== newState.containerRef) {
      try {
        this.updateInspector(this.state);
      } catch (e) {
        // do nothing
      }
    }

    // Send these always
    this.chatLogUpdated(this.props.document.documentId, newState.logEntries);
    this.sendToExtension(ExtensionChannel.HighlightedObjectsUpdated, newState.highlightedObjects);

    if (JSON.stringify(oldState.inspectObj) !== JSON.stringify(newState.inspectObj)) {
      this.inspect(newState.inspectObj);
    }

    if ((oldState.themeInfo || { themeName: '' }).themeName !== (newState.themeInfo || { themeName: '' }).themeName) {
      this.sendToExtension(ExtensionChannel.Theme, newState.themeInfo);
    }
  }