Skip to content

Commit

Permalink
[deps]: Upgrade redux and react-redux to latest version (#2623)
Browse files Browse the repository at this point in the history
## Which problem is this PR solving?
- resolves #2530

## Description of the changes
- With redux 5, type of an action is now a `string`. According to them,
this change is to make the action obj serializable. Change log:
https://redux.js.org/usage/migrations/migrating-rtk-2#action-types-must-be-strings
- In the test, due to some import error, redux no longer has
configurable properties, and jest requires them to be configurable for
spying and changing their behavior. [More
context](https://stackoverflow.com/a/72885576/17456074) on this.
- Since we are using `requireActual` in `jest.mock`, it would anyway be
the actual implementation of functions for other test cases.

## How was this change tested?
- `npm run start` is working fine

## How was this upgrade carried out?
1. `npm uninstall react-redux -w packages/jaeger-ui` to remove
`react-redux`
2. `npm uninstall redux -w packages/jaeger-ui` to remove `redux`
3. `npm install react-redux -w packages/jaeger-ui` to install
react-redux latest version. This installed the latest version but the
package was nested in jaeger-ui node modules so had to do step 4.
4. Even with 2nd step, there was an entry of redux v4.2.1 in lockfile
and package was installed in root node_modules.
5. I manually removed that entry from lockfile, and again ran `npm
install redux -w packages/jaeger-ui`. This worked.
6. Again ran `npm uninstall react-redux -w packages/jaeger-ui` to remove
`react-redux` nested entry in lockfile
7. `npm install react-redux -w packages/jaeger-ui` to install
react-redux latest version. This finally created an entry in root
node_modules in lockfile.

## Checklist
- [x] I have read
https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md
- [x] I have signed all commits
- [x] I have added unit tests for the new functionality
- [x] I have run lint and test steps successfully
  - for `jaeger`: `make lint test`
  - for `jaeger-ui`: `npm run lint` and `npm run test`

Signed-off-by: Hariom Gupta <guptahariom03082003@gmail.com>
Co-authored-by: Yuri Shkuro <yurishkuro@users.noreply.github.com>
  • Loading branch information
hari45678 and yurishkuro authored Jan 25, 2025
1 parent ece0461 commit b2d6e2e
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 55 deletions.
75 changes: 24 additions & 51 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/jaeger-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,13 @@
"react-icons": "^5.0.1",
"react-is": "^18.2.0",
"react-json-view-lite": "2.3.0",
"react-redux": "^8.1.2",
"react-redux": "^9.2.0",
"react-router-dom": "5.3.4",
"react-router-dom-v5-compat": "^6.24.0",
"react-vis": "1.11.12",
"react-vis-force": "^0.3.1",
"react-window": "^1.8.10",
"redux": "^4.2.1",
"redux": "^5.0.1",
"redux-actions": "2.6.5",
"redux-first-history": "^5.2.0",
"redux-promise-middleware": "^6.1.3",
Expand Down
7 changes: 7 additions & 0 deletions packages/jaeger-ui/src/components/TraceDiff/TraceDiff.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ import * as TraceDiffUrl from './url';
import * as jaegerApiActions from '../../actions/jaeger-api';
import { fetchedState, TOP_NAV_HEIGHT } from '../../constants';

/*
With v5+, redux no longer supports `bindActionCreators` to be configured.
`configurable: true` has to be supported by the compilers for it to be configured.
It has to be explicitly told using `__esModule` to babel for compiling it with that property.
*/
jest.mock('redux', () => ({ __esModule: true, ...jest.requireActual('redux') }));

describe('TraceDiff', () => {
const defaultA = 'trace-id-a';
const defaultB = 'trace-id-b';
Expand Down
3 changes: 1 addition & 2 deletions packages/jaeger-ui/src/types/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import { Router } from 'react-router-dom';
import { Location } from 'history';

import { Action } from 'redux';
import { ApiError } from './api-error';
import { TracesArchive } from './archive';
import { Config } from './config';
Expand Down Expand Up @@ -47,7 +46,7 @@ export type LocationState = {

export type ReduxState = {
archive: TracesArchive;
type: Action;
type: string;
config: Config;
ddg: TDdgState;
dependencies: {
Expand Down

0 comments on commit b2d6e2e

Please sign in to comment.