Raja-Hamid opened a new pull request, #6050:
URL: https://github.com/apache/texera/pull/6050

   ### What changes were proposed in this PR?
   
   The **Admin → Executions** page had an inconsistent, "jumpy" page-number bar 
compared to every other list in the app (#3586).
   
   **Root cause.** It was the only paginated page that re-ran its entire query 
every second via `setInterval(() => this.ngOnInit(), 1000)` while driving a 
*manual server-side* pager (`[nzFrontPagination]="false"` with bound 
`[nzPageIndex]`/`[nzPageSize]`/`[nzTotal]`). Every tick reassigned the data and 
total under the pager, with no request cancellation, so the bar reshuffled 
every second and raced the user's clicks. Separately, `onQueryParamsChange` 
used an `else-if` that dropped the page index whenever the page size changed, 
desyncing the highlighted page from the data.
   
   **Fix (frontend-only, `admin-execution.component.ts`):**
   - The 1s interval now only ticks the client-side elapsed-time/status of 
already-loaded rows (`updateTimeStatus()`); data is refreshed by a decoupled 
**5s `switchMap`-cancelled poll** that refetches only the current page, never 
touches page index/size, and updates the total only when it actually changed.
   - Rewrote `onQueryParamsChange` to read page size **and** index from every 
event and clamp the page into range (order-independent) — fixing the 
size-change desync and the out-of-range/empty cases.
   - Split `fetchData()` (user-initiated) and `fetchCurrentPage()` 
(background/silent); kill/pause/resume now trigger a prompt refresh instead of 
waiting for the next tick.
   
   **Before:** the bar flickered/reshuffled every second and could jump on 
click or page-size change.
   **After:** the bar is stable when idle, follows clicks, re-centers 
predictably, and clamps correctly on page-size change — consistent with the 
rest of the app (e.g. Admin → Users).
   
   <img width="1918" height="870" alt="Page Bar Demo (After)" 
src="https://github.com/user-attachments/assets/ee19485e-03fd-4f51-b1c3-45dd8349ce06";
 />
   
   ### Any related issues, documentation, discussions?
   
   Closes #3586
   
   ### How was this PR tested?
   
   **Unit tests (Vitest)** — added 8 cases in 
`admin-execution.component.spec.ts` covering first/last page, page-size change, 
order-independent size+index change, single-page, empty results, and 
no-double-fetch on sort/filter:
   
   corepack yarn ng test --watch=false 
--include="**/admin-execution.component.spec.ts"
   → **10/10 passing** (8 new + 2 existing). Three of the new cases were red 
against the old code (page-size-change desync, order-independent size+index 
change, empty-results clamp) and green after the fix.
   
   **Manual** — ran the `bin/single-node` stack + `ng serve`, seeded ~65 
workflows/executions, and verified on Admin → Executions that the page bar 
follows clicks, re-centers, stays idle-stable, and clamps on page-size change; 
compared side-by-side against Admin → Users (built-in pager) — now consistent.
   
   ### Was this PR authored or co-authored using generative AI tooling?
   
   Generated-by: Yes, alongside Claude Code


-- 
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]

Reply via email to