Skip to content

Comments

Fix experimental stacks feature accidentally leaking into the ethui#1495

Merged
naps62 merged 2 commits intomainfrom
fix-stacks
Nov 7, 2025
Merged

Fix experimental stacks feature accidentally leaking into the ethui#1495
naps62 merged 2 commits intomainfrom
fix-stacks

Conversation

@naps62
Copy link
Member

@naps62 naps62 commented Nov 7, 2025

No description provided.

Copilot AI review requested due to automatic review settings November 7, 2025 16:08
@naps62 naps62 added the B-bugfix Something is working again label Nov 7, 2025
@naps62 naps62 enabled auto-merge (squash) November 7, 2025 16:09
@naps62 naps62 merged commit 14b86a6 into main Nov 7, 2025
8 checks passed
@naps62 naps62 deleted the fix-stacks branch November 7, 2025 16:10
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds conditional rendering for the "Local Stacks" feature based on a runtime check. The changes introduce a new backend call (is_stacks_enabled) to determine if the Stacks feature is available, and conditionally shows/hides UI elements accordingly.

Key changes:

  • Added useInvoke hook calls to check if Stacks is enabled via is_stacks_enabled backend command
  • Wrapped "Enable Stacks" settings toggle in conditional rendering
  • Wrapped the entire "Local Stacks" section in the networks page with conditional rendering
  • Added enabled option to the runtime state query to prevent unnecessary calls when Stacks is disabled

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
gui/src/routes/home/_l/settings/_l/general.tsx Conditionally renders the "Enable Stacks" toggle based on isStacksEnabled flag
gui/src/routes/home/_l/networks/_l/index.tsx Conditionally renders the entire "Local Stacks" section and optimizes the runtime state query

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

refetchInterval: ({ data }: { data: { running: boolean } | null }) =>
data?.running ? false : 1000,
refetchOnWindowFocus: false,
enabled: isStacksEnabled,
Copy link

Copilot AI Nov 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The enabled option will be undefined when isStacksEnabled is not yet loaded, which could cause the query to execute when it shouldn't. Change to enabled: isStacksEnabled === true or enabled: !!isStacksEnabled to ensure the query only runs when explicitly enabled.

Suggested change
enabled: isStacksEnabled,
enabled: isStacksEnabled === true,

Copilot uses AI. Check for mistakes.
);

if (!networks || !settings || runtimeLoading) {
if (!networks || !settings || (isStacksEnabled && runtimeLoading)) {
Copy link

Copilot AI Nov 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The loading condition doesn't account for when isStacksEnabled is still loading (undefined). When isStacksEnabled is undefined, the component won't show a loading state but will proceed to render, potentially showing the Stacks section briefly before it loads. Consider adding a check for the loading state of isStacksEnabled query using isLoading from useInvoke.

Copilot uses AI. Check for mistakes.
}
/>
</div>
{isStacksEnabled && (
Copy link

Copilot AI Nov 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When isStacksEnabled is undefined (during initial load), the switch will be hidden. This creates a flash where the UI element appears/disappears. Consider checking the loading state from useInvoke and showing a loading indicator, or default to showing the switch until the query completes.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

B-bugfix Something is working again

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants