Skip to content

Conversation

Copy link

Copilot AI commented Jan 13, 2026

The alt-text sidebar was re-fetching from the multinet API on every open/close toggle. The useEffect hook had open in its dependency array, causing unnecessary regeneration when only visibility changed.

Changes:

  • Removed open from useEffect dependencies in AltTextSidebar.tsx
  • Removed if (open) guard, allowing generation to occur regardless of sidebar visibility state
  • Alt text now regenerates only when currState or generateAltText changes

The MUI Drawer with variant="persistent" keeps the component mounted when closed, so alt text persists across toggles without re-fetching.

// Before
useEffect(() => {
  setAltText(null);
  if (open) generate();
}, [currState, generateAltText, open]);

// After
useEffect(() => {
  setAltText(null);
  generate();
}, [currState, generateAltText]);

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://storage.googleapis.com/chrome-for-testing-public/143.0.7499.4/linux64/chrome-headless-shell-linux64.zip
    • Triggering command: /usr/local/bin/node /usr/local/bin/node /home/REDACTED/work/upset2/upset2/node_modules/playwright-core/lib/server/registry/oopDownloadBrowserMain.js (http block)
  • https://storage.googleapis.com/chrome-for-testing-public/143.0.7499.4/linux64/chrome-linux64.zip
    • Triggering command: /usr/local/bin/node /usr/local/bin/node /home/REDACTED/work/upset2/upset2/node_modules/playwright-core/lib/server/registry/oopDownloadBrowserMain.js (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>alt-text panel toggle always triggers a re-request to the multinet API</issue_title>
<issue_description>Should probably use hidden instead to avoid unmounting the component</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@netlify
Copy link

netlify bot commented Jan 13, 2026

Deploy Preview for upset2 ready!

Name Link
🔨 Latest commit 48151ce
🔍 Latest deploy log https://app.netlify.com/projects/upset2/deploys/6966773b1753490008afc4ac
😎 Deploy Preview https://deploy-preview-592--upset2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Remove 'open' from useEffect dependencies in AltTextSidebar to prevent
re-fetching alt text every time the sidebar is toggled. The component
now only fetches alt text when currState or generateAltText changes,
and the MUI Drawer handles show/hide via the open prop without unmounting.

Co-authored-by: JackWilb <36867477+JackWilb@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix alt-text panel toggle to avoid re-request to multinet API Remove open dependency from AltTextSidebar useEffect to prevent redundant API calls Jan 13, 2026
Copilot AI requested a review from JackWilb January 13, 2026 16:53
@JackWilb JackWilb marked this pull request as ready for review January 13, 2026 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

alt-text panel toggle always triggers a re-request to the multinet API

2 participants