Skip to content

Commit fe3ce3f

Browse files
committed
fix(ui): avoid stale closure when clearing connectivity error
Always dispatch setConnectivityError(null) on successful API response instead of conditionally checking connectivityError. This avoids stale closure issues where the callback captures an outdated value. References: #RI-7761
1 parent 610aa24 commit fe3ce3f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

redisinsight/ui/src/components/database-overview/hooks/useDatabaseOverview.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@ export const useDatabaseOverview = () => {
5252
if (connectedInstanceId) {
5353
dispatch(
5454
getDatabaseConfigInfoAction(connectedInstanceId, () => {
55-
// Clear connectivity error on successful API call
56-
if (connectivityError) {
57-
dispatch(setConnectivityError(null))
58-
}
55+
// Clear connectivity error on successful API call.
56+
// Always dispatch to avoid stale closure issues - dispatching null
57+
// when there's no error is a safe no-op.
58+
dispatch(setConnectivityError(null))
5959
}),
6060
)
6161
setLastRefreshTime(Date.now())

0 commit comments

Comments
 (0)