Skip to content

Part of Phase 1 (1f): remove config Redux slice; use getConfig via useConfig#3781

Open
Parship12 wants to merge 2 commits intojaegertracing:mainfrom
Parship12:migrate-config
Open

Part of Phase 1 (1f): remove config Redux slice; use getConfig via useConfig#3781
Parship12 wants to merge 2 commits intojaegertracing:mainfrom
Parship12:migrate-config

Conversation

@Parship12
Copy link
Copy Markdown
Member

@Parship12 Parship12 commented Apr 27, 2026

Which problem is this PR solving?

  • Resolves Tracking: ADR 0004 Migrate from Redux to Zustand + TanStack React Query #3657
  • Phase 1f of ADR 0004: remove the config Redux slice. Application config is static for a page load (assembled once from getConfig()), so keeping it in redux duplicate that source of truth without any actions or updates.
  • Here no Zustand because: Config does not change at runtime after the memoized getConfig() first run. A Zustand store would add subscription/update machinery with no set path, so like written in ADR “Zustand or module constant” option is satisfied by getConfig() + useConfig().

Description of the changes

  • useConfig() now return getConfig() directly instead of useSelector(state => state.config).
  • Removed reducers/config.ts and its test, removed config from the root reducer map and from ReduxState.

How was this change tested?

  • Unit tests

Checklist

AI Usage in this PR (choose one)

See AI Usage Policy.

  • None: No AI tools were used in creating this PR
  • Light: AI provided minor assistance (formatting, simple suggestions)
  • Moderate: AI helped with code generation or debugging specific parts
  • Heavy: AI generated most or all of the code changes

Signed-off-by: Parship Chowdhury <parshipchowdhury@gmail.com>
Copilot AI review requested due to automatic review settings April 27, 2026 07:43
@Parship12 Parship12 requested a review from a team as a code owner April 27, 2026 07:43
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.58%. Comparing base (ff31ab4) to head (b454dd9).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3781      +/-   ##
==========================================
- Coverage   90.58%   90.58%   -0.01%     
==========================================
  Files         334      333       -1     
  Lines       10483    10478       -5     
  Branches     2737     2736       -1     
==========================================
- Hits         9496     9491       -5     
  Misses        860      860              
  Partials      127      127              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR is part of the UI state-management migration (Phase 1, item 1f), removing the Redux config slice and switching config access to the useConfig() hook (backed by getConfig()), plus updating affected tests and ADR status.

Changes:

  • Remove config from the Redux root state typing and reducer set (delete reducers/config and its test).
  • Update useConfig() to return getConfig() directly, and replace Redux-based hook tests with getConfig-mock-based tests.
  • Rewire/selectively update component tests and docs to reflect the removal of the Redux config slice.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/jaeger-ui/src/types/index.ts Removes config from ReduxState typing.
packages/jaeger-ui/src/reducers/index.ts Removes config reducer from the root reducer map.
packages/jaeger-ui/src/reducers/config.ts Deletes the Redux config slice reducer.
packages/jaeger-ui/src/reducers/config.test.ts Deletes tests for the removed reducer.
packages/jaeger-ui/src/hooks/useConfig.ts Switches hook implementation from Redux selector to getConfig().
packages/jaeger-ui/src/hooks/useConfig.test.tsx Removes Redux-store-based hook tests.
packages/jaeger-ui/src/hooks/useConfig.test.ts Adds getConfig()-mock-based hook tests.
packages/jaeger-ui/src/components/TracePage/index.test.jsx Updates mapStateToProps tests to remove config usage (but introduces an inconsistency).
packages/jaeger-ui/src/components/SearchTracePage/index.test.jsx Updates tests to mock config via get-config instead of a Redux config slice.
packages/jaeger-ui/src/components/App/TopNav.tsx Starts using useConfig() for menu config (still mixes in direct getConfig() calls).
packages/jaeger-ui/src/components/App/TopNav.test.jsx Updates tests to mock useConfig() and resets mocks appropriately.
docs/adr/0004-state-management-strategy.md Marks phases 1e and 1f as completed.
Comments suppressed due to low confidence (1)

packages/jaeger-ui/src/components/TracePage/index.test.jsx:1133

  • mapStateToProps() is called twice with the same state/ownProps, but the tests now assert two different exact shapes: one expects only { id, trace } and the new one expects { id, uiFind: undefined, trace }. Since mapStateToProps spreads extractUiFindFromState(state) (which returns { uiFind: undefined } when no query param is present), at least one of these expectations will fail. Update the assertions to be consistent (e.g., include uiFind in the expected object or use expect.objectContaining).
  it('returns the correct props shape', () => {
    const props = mapStateToProps(state, ownProps);
    expect(props).toEqual({
      id: traceID,
      uiFind: undefined,
      trace: { data: {}, state: fetchedState.DONE },
    });
  });

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/jaeger-ui/src/components/App/TopNav.tsx
Comment thread packages/jaeger-ui/src/components/App/TopNav.tsx
Comment thread packages/jaeger-ui/src/hooks/useConfig.test.ts Outdated
Signed-off-by: Parship Chowdhury <parshipchowdhury@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tracking: ADR 0004 Migrate from Redux to Zustand + TanStack React Query

2 participants