Repository navigation
Fix issue #3666 - #3669
Fix issue #3666#3669integry merged 2 commits into
Conversation
…elected through background refreshes, for both finished and "Needs review" runs. A Playwright test checks this in Chromium. I only reproduced the problem in a real browser for automation runs; the other views were checked by reading the code, not with the selection test the issue asks for. Root cause. The shared Markdown component, `MarkdownRenderer.tsx`, handed the Markdown library new component functions on every render. React treats each new function as a different component, so every re-render threw away and rebuilt every heading, paragraph and list item, which drops any selection. This happened even when the text hadn't changed. Two things kept triggering re-renders: - The automations page: its run-state timers (every 5s, and every 30s for all automations) stored a new object even when nothing changed. That re-rendered the open run, including finished runs. - `useAgentRun`: it stored a new run object on every 10-second reload of a run that hasn't finished. The detail pane was never remounted and no loading placeholder ever replaced the report; it was always this re-render. What changed - `MarkdownRenderer.tsx`: the component overrides are built once per theme and reused, and the output is memoised on the text. Appended text only adds at the end, so a selection in earlier text survives in streaming views. Code-block file labels are now matched by line number. - `src/utils/keepIfEqual.ts` (new shared helper): keeps the previous value when a refresh returns deep-equal data, otherwise takes the new one. - `useAgentRun.ts`: uses the helper. Finished runs were already loaded once and never polled again; a test now enforces that. - `AgentsPage.tsx`: an unchanged run state no longer re-renders the page. - `AgentList.tsx`: the list's "next in …" time only moved on because of those re-renders. The list now has its own one-minute clock, so it stays current without disturbing the run beside it. Views checked | View | Problem? | Change | |---|---|---| | Automation run report, action result, brief | Yes, reproduced in browser | All of the above | | Task detail (summary, output, logs, diff/review) | Yes: same Markdown component, plus a whole-task reload every 5 min | Markdown fix; `useTaskData` keeps equal history, task info, usage, budget and previews | | Goal detail and goals list | New object on every goal/task event | Fixed through the shared live-data hook (`useLiveResource`), plus the Markdown fix | | Plan Studio (issue bodies, refinement chat) | Markdown remounts; background draft reloads | Markdown fix; `useDraft` keeps an equal draft | | Inbox preview | Background reads replaced the list | `useInboxNotifications` keeps an equal list, plus the Markdown fix | | Repository chat | Markdown remounts only | Markdown fix | | Settings → Maintenance, Agent runtime packages | Polled, new objects each time | Keep equal results | | LLM Log, MCP Log expanded rows | No: they don't refresh in the background | None | | Pull request views | No separate Markdown path or background poll found | None | Tests - Helper test: equal data keeps the previous reference, changed data replaces it. - `MarkdownRenderer` tests: same text keeps every element, appended text keeps earlier elements, changed text updates, file labels still work. - `AgentRunDetail.refresh.test.tsx`: a finished run is read exactly once and its report nodes stay the same instances through page re-renders; a "Needs review" run is read 4 times with the same nodes and no loading placeholder; a changed report updates. - Regression tests for `useLiveResource` and for `AgentsPage` (an unchanged read doesn't re-render the open run). - Playwright `e2e/automation-run-report-selection.pw.ts`: selects a paragraph in a long report, scrolls, lets 35 seconds of refresh timers run, then checks the selection and scroll position are kept. I ran the new tests against the original code and they failed there, including both Playwright cases: the selected paragraph was replaced by a new one. The full propr-ui unit suite passes (3435 tests), and lint and typecheck are clean. I didn't capture a preview image, because the change is about behaviour over time and nothing looks different in a screenshot.
|
🔀 Resolved merge conflicts from Conflicting Files
Resolution SummaryI resolved the conflict. It was only in What the conflict was about
How I resolved it
Why Checks
🤖 Resolution Details
System-triggered merge conflict resolution |
…-5-5-background-refresh-re-ren-20261117-1013-y0m Automatically resolved merge conflicts after merging target branch into PR branch. Resolved conflicts in: - propr-ui/src/components/Agents/useAgentRun.ts PR: #3669 Model: Claude Opus 5.5
|
/ultrafix goal=8 max=5 |
|
🔄 Ultrafix loop started (goal: 8/10, max cycles: 5) First action:
|
|
✅ AI Code Review Complete requested by @integry Posted 1 review: |
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationReady to merge based on the supplied diff and static review. The PR addresses report-selection loss by stabilizing Markdown component identities and preserving equal data references during refreshes. ✅ Stable Markdown components — Cached component overrides remove the per-render component-type changes that previously remounted report elements. ✅ Targeted regression coverage — Added tests cover unchanged refreshes, genuinely changed reports, DOM identity, and browser selection and scroll preservation. ✅ Schedule freshness preserved — The list’s independent clock keeps schedule summaries current when unchanged run states stop triggering page renders. The authoritative current-head status reports 15 passed checks, with none failed or pending. No commands or tests were run during this review. Merge blockersNo merge blockers. SuggestionsThese are optional follow-ups and are not sent to S1: 🟢 Narrow the render guaranteesThe new comment in S2: 🟢 Cover independent code-path contextsAn optional test rendering two ScoreThe implementation addresses the demonstrated remount mechanism, preserves changed-data updates, and adds focused regression coverage. Static review found no merge blockers, and current-head checks report no failures. Score: 9/10 🤖 Review Details
Copy and edit to choose records from this review: 🤖 Review by ProPR |
Resolves #3666
PR created via retry mechanism