PMM-14640: [UI] FOC observed on Inventory service agents page#865
Merged
matejkubinec merged 3 commits intov3from Jan 9, 2026
Merged
Conversation
- Remove !servicesLoading condition from service title render (line 203) - Remove !nodesLoading condition from node title render (line 209) - Keep title visible during data refresh to prevent layout shift - Fixes FOC (Flash of Content) issue during auto-refresh
There was a problem hiding this comment.
Pull request overview
This PR fixes a Flash of Content (FOC) issue on the Inventory service agents page by removing unnecessary loading state checks from conditional rendering logic.
Key Changes:
- Removed
!servicesLoadingcondition from service breadcrumb rendering - Removed
!nodesLoadingcondition from node breadcrumb rendering
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
fabio-silva
approved these changes
Dec 23, 2025
This commit fixes critical issues causing memory leaks and unwanted API requests that continue after component unmount, particularly the /v1/inventory/services:getTypes request that persists on agent pages. Root Cause: 1. Services.tsx: useRecurringCall creates recursive timer chains that continue executing after unmount due to race conditions in cleanup 2. Agents.tsx & Nodes.tsx: Empty dependency arrays caused stale closures, capturing outdated values and preventing proper cleanup 3. Agents.tsx: 7 unstable dependencies including Redux objects caused excessive re-renders Fixes Applied: Services.tsx: - Added isMountedRef to track component mount state - loadData now checks isMounted before making requests - Prevents zombie requests when recurring timer fires after unmount - Added stopTimeout to cleanup function - Fixed stale closure by adding [dispatch, generateToken] dependencies Agents.tsx: - Fixed stale closure in loadData by adding proper dependencies - Refactored useEffect from 7 to 4 primitive dependencies - Extracted currentServiceId/currentNodeId to avoid object reference issues - Changed to async pattern with early returns for better control flow - Reduced coupling with Redux state updates Nodes.tsx: - Fixed stale closure in loadData by adding [dispatch, generateToken] All changes include detailed comments explaining the problems and solutions to help future maintainers understand the reasoning. Testing: - All inventory tests pass (9 suites, 39 tests) - ESLint passes on modified files - Webpack compiles successfully - Manual testing confirms zombie requests are eliminated
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is this feature?
https://perconadev.atlassian.net/browse/PMM-14640
Why do we need this feature?
Who is this feature for?
Which issue(s) does this PR fix?:
FB:
Percona-Lab/pmm-submodules#4170
Fixes #
Screen.Recording.2025-12-23.at.14.26.31.mov
Special notes for your reviewer:
Please check that: