Skip to content

Fix underspecified react hooks and add linting for it#927

Merged
timja merged 5 commits intojenkinsci:mainfrom
das7pad:react-hooks-linting
Jul 29, 2025
Merged

Fix underspecified react hooks and add linting for it#927
timja merged 5 commits intojenkinsci:mainfrom
das7pad:react-hooks-linting

Conversation

@das7pad
Copy link
Contributor

@das7pad das7pad commented Jul 27, 2025

While working on the recent frontend changes and upcoming polling changes for logging, I noticed that many react dependencies are underspecified. In many cases we rely on other dependencies to trigger re-runs or depend on frequent re-rendering for behavior.

This PR is addressing all underspecified react hooks and adds linting to enforce them moving forward. Follow up changes will address some of the frequent re-rendering.

I've done some additional code cleanup/dead code removal to simplify the hook changes. LMK if you want me to move these to other PRs. Theses changes are in separate commits.
There are some indentation changes, so this PR is best reviewed with white space changes ignored.

The eslint plugin eslint-plugin-react-hooks is maintained upstream:

Testing done

  • The current stage is highlighted (stageIsSelected and hasSelectedDescendant changes)
  • Polling of logs works with the same bugs as before
  • Time duration is updated on pending jobs
  • Persistent links are working
  • Both graph positions (top/left) are looking good

Submitter checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests that demonstrate the feature works or the issue is fixed

@das7pad das7pad requested a review from a team as a code owner July 27, 2025 21:44
@timja timja added the chore a PR that adds to maintenance - used by Release Drafter label Jul 29, 2025
Copy link
Member

@timja timja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@timja timja added bug Something isn't working and removed chore a PR that adds to maintenance - used by Release Drafter labels Jul 29, 2025
@timja timja merged commit b82beed into jenkinsci:main Jul 29, 2025
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants