Project

General

Profile

Actions

Bug #39338

closed

LoadingState component does not clear setTimeout on unmount

Added by Zach Huntington-Meath about 2 months ago. Updated about 1 month ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Organizations and Locations
Target version:
Difficulty:
Triaged:
Yes
Fixed in Releases:
Found in Releases:

Description

Description

The LoadingState class component in webpack/components/LoadingState/LoadingState.js sets a setTimeout in componentDidMount but never clears it in componentWillUnmount. This causes a React warning ("Cannot update state on an unmounted component") when the component unmounts before the timeout fires.

This bug was introduced in commit 4c976ff (Fixes #24288 - add a delay for loading state) and has existed since then. It was not caught until #39307 (Migrate SetOrganization component from PF3 to PF5, PR #11734) added tests that unmount a component wrapping LoadingState quickly enough to trigger the warning. PR #11734 did not modify LoadingState itself.

Impact

The test environment (global_test_setup.js) promotes console.error to thrown errors, so the React unmount warning becomes a test failure. This breaks 4 of 5 tests in SetOrganization.test.js in CI (katello-master-source-release): 2 direct failures from the unmount error, plus 2 cascading failures.

Steps to Reproduce

  1. Run: bundle exec npm run test:plugins katello
  2. Observe SetOrganization.test.js failures
  3. Root cause: LoadingState unmount warning thrown as error

Root Cause

webpack/components/LoadingState/LoadingState.js lines 15-18:

componentDidMount() {
  setTimeout(() => {
    this.setState({ render: true });
  }, this.props.timeout);
}

The timeout ID is not stored, and there is no componentWillUnmount to clear it.

CI Log

See katello-master-source-release build logs from 2026-05-19. 1 suite failed (SetOrganization.test.js), 158 suites passed; 4 tests failed, 956 passed.

Actions #1

Updated by Zach Huntington-Meath about 2 months ago

  • Red Hat JIRA set to SAT-45546
Actions #2

Updated by Zach Huntington-Meath about 2 months ago

  • Description updated (diff)
Actions #3

Updated by Zach Huntington-Meath about 2 months ago

  • Description updated (diff)
Actions #4

Updated by The Foreman Bot about 2 months ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/Katello/katello/pull/11758 added
Actions #5

Updated by The Foreman Bot about 2 months ago

  • Fixed in Releases Katello 5.0.0 added
Actions #6

Updated by Anonymous about 2 months ago

  • Status changed from Ready For Testing to Closed
Actions #7

Updated by Jeremy Lenz about 2 months ago

  • Category set to Organizations and Locations
  • Target version set to Katello 4.21.0
  • Triaged changed from No to Yes
Actions #8

Updated by The Foreman Bot about 1 month ago

  • Fixed in Releases Katello 4.21.0 added
Actions

Also available in: Atom PDF