Repository navigation
[release-5.0] OCPBUGS-133830: Fix events page rendering as 0px-tall list - #17438
Conversation
The events page showed only "Older events are not stored." because the virtualized list collapsed to 0px tall. react-virtualized was bumped from 9.x to ^9.22.6 in e139d7c (CONSOLE-5065), and 9.22.6 removed CellMeasurer's findDOMNode fallback. CellMeasurer now cloneElements the element returned by its render prop and attaches a ref to measure it, so that element must be a DOM node or forward one. SysEvent was a class component, so the cloned ref held the class instance instead of a DOM node. CellMeasurer's _getCellMeasurements failed its instanceof HTMLElement check and returned {height: 0, width: 0} for every row, stacking all rows at top: 0 with height 0 and collapsing the container. Other CellMeasurer consumers were unaffected because TableRow is a forwardRef and virtualized-grid/Cell.tsx renders a plain div. Convert SysEvent to a forwardRef function component that forwards the ref to its wrapper div, replace shouldComponentUpdate with memo and a custom comparator preserving the same logic, and move the componentWillUnmount cleanup of the seen animation set into a useEffect. Drop the dead onLoad/onEntered props from the render-prop usage. Add a regression test that stubs jsdom geometry (offsetHeight, offsetWidth, getBoundingClientRect all report 0) and asserts the inner scroll container height equals rows times row height, which stays at 0 with the class-component pattern. Assisted-by: glm-5-3
…ging ref CellMeasurer creates a new callback ref on each render, and React only takes the memo bailout when the ref is also unchanged (compare(prevProps, nextProps) && current.ref === workInProgress.ref in updateMemoComponent). With memo wrapping the ref-forwarding SysEvent, every streaming update re-rendered all visible rows even when arePropsEqual returned true, losing the shouldComponentUpdate behavior of the original class component. Move the memo inside a thin ref-forwarding wrapper: SysEvent forwards the ref to its wrapper div and keeps the animation logic and cleanup, while the memoized SysEventContent renders the event row and never receives a ref, so the memo bailout holds. Add a test that rerenders with the same events array (so the measurement cache is not cleared and row styles are unchanged) and asserts the row content does not re-render. Assisted-by: glm-5-3
SysEvent mutated the seen set during render and recomputed shouldAnimate from it on every pass, so a rerender dropped co-sysevent-slide-in mid-animation. The restructure in 7a8a5bb made this visible: CellMeasurer recreates its callback ref each render, so SysEvent rerenders on every pass instead of being shielded by the old shouldComponentUpdate. Mutating seen during render is also impure — a discarded concurrent render would mark an event seen. Decide once per mount with a useState initializer that only reads the seen set, and record the UID in an effect after commit. The index < 6 eligibility condition is unchanged. Add a test asserting a rerender keeps the slide-in class on an animating row; it fails against the previous render-time mutation. Assisted-by: glm-5-3
…ndices The virtualized event list keys rows by index, so when a new event streams in (events sort newest-first), the row at an existing index stays mounted and receives a new event prop. Two bugs followed from that: - SysEventContent's memo comparator only compared lastTimestamp, so a distinct event with an identical timestamp taking over an index kept rendering the previous event's content. - shouldAnimate is computed once per mount via useState, so a new event at a reused index inherited the previous event's animation decision: the slide-in class persisted on the same DOM node and the CSS animation never replayed for the new event. Key SysEvent by event UID (inside the render prop, distinct from the index-keyed CellMeasurer) so a different event remounts the row and recomputes animation eligibility, and compare the UID in the memo comparator so replacement events always rerender. Also track every mounted UID in the seen set, not just animated ones. With per-UID remounting, a UID that shifts indices would otherwise be deleted by its old row's cleanup and never re-added by its new mount (shouldAnimate=false), re-animating on the next shift. Assisted-by: glm-5-3
Combined events (events.k8s.io series) update series.count and series.lastObservedTime while their lastTimestamp stays unchanged, so the SysEventContent memo comparator bailed out and rows kept showing a stale occurrence count. Compare series.count and series.lastObservedTime in arePropsEqual so series updates rerender the row content. Assisted-by: glm-5-3
The row content memo compared series.count/lastObservedTime for combined events.k8s.io events but not the deprecated count field that core/v1 events use. The event component renders series ? series.count : event.count, so a core/v1 event combining into a higher count with an unchanged lastTimestamp kept showing the stale count. Add event.count to the comparator, with a test that updates only a count field and asserts only that row's content rerenders. Assisted-by: glm-5-3
|
Pipeline controller notification This PR uses the pipeline controller for second-stage tests. Selection and triggering follow the repository configuration. Use |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
|
@openshift-cherrypick-robot: Jira Issue OCPBUGS-132821 has been cloned as Jira Issue OCPBUGS-133830. Will retitle bug to link to clone. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
@openshift-cherrypick-robot: This pull request references Jira Issue OCPBUGS-133830, which is valid. The bug has been moved to the POST state. 7 validation(s) were run on this bug
The bug has been updated to refer to the pull request using the external bug tracker. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
logonoff
left a comment
There was a problem hiding this comment.
/lgtm
/label backport-ridk-assessed
|
@logonoff: The label(s) DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
Scheduling tests matching the |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: logonoff, openshift-cherrypick-robot The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/label backport-risk-assessed |
|
/verified by @logonoff
|
|
@logonoff: This PR has been marked as verified by DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
e2e failure isn't related to events page |
|
@logonoff: Overrode contexts on behalf of logonoff: ci/prow/e2e-gcp-console DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
6ebef74
into
openshift:release-5.0
|
@openshift-cherrypick-robot: Jira Issue Verification Checks: Jira Issue OCPBUGS-133830 Jira Issue OCPBUGS-133830 has been moved to the MODIFIED state and will move to the VERIFIED state when the change is available in an accepted nightly payload. 🕓 DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |

This is an automated cherry-pick of #17417
/assign logonoff