Skip to content

Commit

Permalink
Fix errors
Browse files Browse the repository at this point in the history
  • Loading branch information
estruyf committed Nov 28, 2024
1 parent f38144b commit 98c5b56
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
13 changes: 10 additions & 3 deletions src/panelWebView/components/Fields/TextField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,10 @@ export const TextField: React.FunctionComponent<ITextFieldProps> = ({

const border = useMemo(() => {
if (showRequiredState) {
updateRequired(false);
return '1px solid var(--vscode-inputValidation-errorBorder)';
} else if (!isValid) {
updateRequired(true);
return '1px solid var(--vscode-inputValidation-warningBorder)';
} else {
updateRequired(true);
return '1px solid var(--vscode-inputValidation-infoBorder)';
}
}, [showRequiredState, isValid]);
Expand Down Expand Up @@ -162,6 +159,16 @@ export const TextField: React.FunctionComponent<ITextFieldProps> = ({
);
}, [settings?.aiEnabled, settings?.copilotEnabled, settings?.seo, name, actions, loading]);

useEffect(() => {
if (showRequiredState) {
updateRequired(false);
} else if (!isValid) {
updateRequired(true);
} else {
updateRequired(true);
}
}, [showRequiredState, isValid]);

useEffect(() => {
if (text !== value && (lastUpdated === null || Date.now() - DEBOUNCE_TIME > lastUpdated)) {
setText(value || null);
Expand Down
4 changes: 1 addition & 3 deletions src/panelWebView/components/SeoKeywords.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,7 @@ const SeoKeywords: React.FunctionComponent<ISeoKeywordsProps> = ({
<VSCodeTableBody>
{validKeywords.map((keyword, index) => {
return (
<ErrorBoundary key={`${keyword}-${index}`} fallback={<div />}>
<SeoKeywordInfo keywords={validKeywords} keyword={keyword} {...data} />
</ErrorBoundary>
<SeoKeywordInfo key={`${keyword}-${index}`} keywords={validKeywords} keyword={keyword} {...data} />
);
})}
</VSCodeTableBody>
Expand Down

0 comments on commit 98c5b56

Please sign in to comment.