frontend: App.jsx setInterval for metadata refresh never cleared - accumulates on remount, continues after logout
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 40.9k
- Forks
- 5.4k
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 202
Description
Bug Description
App.jsx starts a setInterval for metadata refresh but never stores the return value and never clears it. If the component is unmounted and remounted, a new interval is added each time without cancelling the previous one. Stale intervals continue making authenticated HTTP requests after the user logs out.
Affected file
rontend/src/App/App.jsx, line 133:
js setInterval(this.fetchMetadata, 1000 * 60 * 60 * 1); // return value discarded - interval can never be cleared
For contrast, ViewerApp.jsx line 112 correctly stores and clears the interval:
js // ViewerApp.jsx - correct pattern this._metadataInterval = setInterval(this.fetchMetadata, interval); // componentWillUnmount: clearInterval(this._metadataInterval);
Failure scenario
- User logs in. App mounts. Interval 1 starts, making metadata requests every hour.
- HMR reload in development (or future routing change) unmounts and remounts App. Interval 2 starts.
- Interval 1 is still running - now two concurrent hourly requests fire.
- Over repeated HMR cycles, N intervals accumulate.
- User logs out. Stale intervals continue calling etchMetadata, triggering 401 responses and unnecessary network activity for the session lifetime.
Fix
`js
componentDidMount() {
this._metadataInterval = setInterval(this.fetchMetadata, 1000 * 60 * 60 * 1);
// ... rest of componentDidMount
}
componentWillUnmount() {
clearInterval(this._metadataInterval);
}
`
Environment
ToolJet main branch (2026-08-13), React (class component).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in frontend/src/App/App.jsx at componentDidMount and the metadata-refresh setInterval around line 133. Compare its lifecycle handling with the working pattern in ViewerApp.jsx around line 112. Done means the interval is retained and cleared when App unmounts, preventing accumulated refreshes and requests after logout.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 90/100