Skip to content

Commit

Permalink
Delay rendering of error message in PO view to avoid flashing
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkusEllyton committed Sep 17, 2024
1 parent 4aea385 commit d50911d
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/webviews/proof_obligations/ProofObligationsTable.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { MouseEvent, useState } from "react";
import React, { MouseEvent, useEffect, useState } from "react";
import { FormattedProofObligation, SelectionState } from "./ProofObligationsView";
import { VSCodeButton, VSCodeDataGrid, VSCodeDataGridCell, VSCodeDataGridRow } from "@vscode/webview-ui-toolkit/react";
import { TableHeader, SortingState } from "./ProofObligationsTableHeader";
Expand Down Expand Up @@ -66,11 +66,21 @@ export interface ProofObligationsTableMessageProps {
}

const ProofObligationsTableMessage = ({ msg }: ProofObligationsTableMessageProps) => {
return (
const [isVisible, setIsVisible] = useState(false);

// Delay the rendeirng of the component, otherwise the component quickly flashes on the screen before being replaced by the table.
useEffect(() => {
const timer = setTimeout(() => {
setIsVisible(true);
}, 500);
return () => clearTimeout(timer);
}, []);

return isVisible ? (
<div css={{ width: "100%", justifyContent: "center", alignItems: "center", display: "flex", flexDirection: "column", flexGrow: 1 }}>
<span css={{ fontSize: "1.25em", color: "var(--vscode-errorForeground)" }}>{msg}</span>
</div>
);
) : null;
};

export interface ProofObligationsTableProps {
Expand Down

0 comments on commit d50911d

Please sign in to comment.