Fix re-renders from adding too many dependencies to useEffect (#2123)
Co-authored-by: Alex Hancock <alexhancock@block.xyz>
This commit is contained in:
@@ -32,7 +32,8 @@ export default function ExtensionsSection() {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
fetchExtensions();
|
fetchExtensions();
|
||||||
}, [fetchExtensions]);
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, []);
|
||||||
|
|
||||||
const handleExtensionToggle = async (extension: FixedExtensionEntry) => {
|
const handleExtensionToggle = async (extension: FixedExtensionEntry) => {
|
||||||
// If extension is enabled, we are trying to toggle if off, otherwise on
|
// If extension is enabled, we are trying to toggle if off, otherwise on
|
||||||
|
|||||||
@@ -43,19 +43,9 @@ export default function ModelsSection({ setView }: ModelsSectionProps) {
|
|||||||
}, [read, getProviders]);
|
}, [read, getProviders]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// Initial load
|
|
||||||
loadModelData();
|
loadModelData();
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
// Set up polling interval to check for changes
|
}, []);
|
||||||
const interval = setInterval(() => {
|
|
||||||
loadModelData();
|
|
||||||
}, 1000); // Check every second
|
|
||||||
|
|
||||||
// Clean up interval on unmount
|
|
||||||
return () => {
|
|
||||||
clearInterval(interval);
|
|
||||||
};
|
|
||||||
}, [loadModelData]);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section id="models" className="px-8">
|
<section id="models" className="px-8">
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ export default function ModelsBottomBar({ dropdownRef, setView }: ModelsBottomBa
|
|||||||
setProvider(modelProvider.provider);
|
setProvider(modelProvider.provider);
|
||||||
setModel(modelProvider.model);
|
setModel(modelProvider.model);
|
||||||
})();
|
})();
|
||||||
}, [read, getProviders]);
|
});
|
||||||
|
|
||||||
// Add click outside handler
|
// Add click outside handler
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ export const AddModelModal = ({ onClose, setView }: AddModelModalProps) => {
|
|||||||
if (attemptedSubmit) {
|
if (attemptedSubmit) {
|
||||||
validateForm();
|
validateForm();
|
||||||
}
|
}
|
||||||
}, [provider, model, attemptedSubmit, validateForm]);
|
}, [attemptedSubmit, validateForm]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
(async () => {
|
(async () => {
|
||||||
|
|||||||
+2
-1
@@ -99,7 +99,8 @@ export default function DefaultProviderSetupForm({
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
loadConfigValues();
|
loadConfigValues();
|
||||||
}, [loadConfigValues]);
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, []);
|
||||||
|
|
||||||
// Filter parameters to only show required ones
|
// Filter parameters to only show required ones
|
||||||
const requiredParameters = useMemo(() => {
|
const requiredParameters = useMemo(() => {
|
||||||
|
|||||||
@@ -61,7 +61,8 @@ export function DeepLinkModal({ botConfig: initialBotConfig, onClose }: DeepLink
|
|||||||
instructions,
|
instructions,
|
||||||
activities,
|
activities,
|
||||||
});
|
});
|
||||||
}, [instructions, activities, botConfig]);
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, [instructions, activities]);
|
||||||
|
|
||||||
// Handle adding a new activity
|
// Handle adding a new activity
|
||||||
const handleAddActivity = () => {
|
const handleAddActivity = () => {
|
||||||
|
|||||||
@@ -525,12 +525,6 @@ test.describe('Goose App', () => {
|
|||||||
|
|
||||||
// Wait a bit and dump HTML to see structure
|
// Wait a bit and dump HTML to see structure
|
||||||
await mainWindow.waitForTimeout(1000);
|
await mainWindow.waitForTimeout(1000);
|
||||||
const html = await mainWindow.evaluate(() => document.documentElement.outerHTML);
|
|
||||||
console.log('Full page HTML after clicking Output:', html);
|
|
||||||
|
|
||||||
// Also dump just the response area HTML
|
|
||||||
const responseHtml = await response.evaluate(el => el.outerHTML);
|
|
||||||
console.log('Response area HTML:', responseHtml);
|
|
||||||
|
|
||||||
// Take screenshot before trying to find content
|
// Take screenshot before trying to find content
|
||||||
await mainWindow.screenshot({ path: `test-results/${provider.name.toLowerCase()}-quote-response-debug.png` });
|
await mainWindow.screenshot({ path: `test-results/${provider.name.toLowerCase()}-quote-response-debug.png` });
|
||||||
|
|||||||
Reference in New Issue
Block a user