bito-code-review[bot] commented on code in PR #44272:
URL: https://github.com/apache/superset/pull/44272#discussion_r4067765110


##########
superset-frontend/src/dashboard/components/Header/useHeaderAutoRefresh.test.tsx:
##########
@@ -152,3 +158,23 @@ test('forceRefresh normalizes a negative config value to 0 
(unstaggered)', async
     expect.objectContaining({ interval: 0 }),
   );
 });
+
+test('a silent refresh reports only the affected chart ids to 
startAutoRefresh, not the whole dashboard', async () => {
+  mockStartAutoRefresh.mockClear();
+  mockUseAutoRefreshTabPause.mockClear();
+  const { props } = renderHeaderAutoRefresh(
+    {},
+    { chartIds: [1, 2], timedRefreshImmuneSlices: [2] },
+  );
+
+  const { onRefresh: handleTabVisibilityRefresh } =
+    mockUseAutoRefreshTabPause.mock.calls[0][0];
+
+  await act(async () => {
+    await handleTabVisibilityRefresh();
+  });
+
+  expect(props.onRefresh).toHaveBeenCalledTimes(1);
+  expect(mockStartAutoRefresh).toHaveBeenCalledWith([1]);
+  expect(mockStartAutoRefresh).not.toHaveBeenCalledWith([1, 2]);
+});

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Test hangs on missing RAF</b></div>
   <div id="fix">
   
   This test drives the `suppressSpinners=true` path, which calls 
`requestAnimationFrame` (useHeaderAutoRefresh.ts:207) to settle the refresh 
promise. jsdom provides no RAF and the repo's test setup has no polyfill, so 
`await handleTabVisibilityRefresh()` never resolves and the test times out. The 
sibling `Header.test.tsx` (742-746) mocks `window.requestAnimationFrame` for 
exactly this path; this test needs the same mock.
   </div>
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #fe6cc3</i></small>
   </div>
   
   ---
   Should Bito avoid suggestions like this for future reviews? (<a 
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
   - [ ] Yes, avoid them



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to