Bug #39338
closedLoadingState component does not clear setTimeout on unmount
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¶
- Run: bundle exec npm run test:plugins katello
- Observe SetOrganization.test.js failures
- 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.
Updated by Zach Huntington-Meath about 2 months ago
- Red Hat JIRA set to SAT-45546
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
Updated by The Foreman Bot about 2 months ago
- Fixed in Releases Katello 5.0.0 added
Updated by Anonymous about 2 months ago
- Status changed from Ready For Testing to Closed
Applied in changeset katello|8704fcadc587ec6c645b7cba4b4e748d0f0fb7c2.
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
Updated by The Foreman Bot about 1 month ago
- Fixed in Releases Katello 4.21.0 added