Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused Redux selectors #1284

Merged
merged 1 commit into from
Mar 18, 2023

Conversation

mszabo-wikia
Copy link
Contributor

Which problem is this PR solving?

  • Contributes towards making coverage reports more consistent

Short description of the changes

Some of the inconsistency of coverage results is due to randomly generated test data in trace.test.js. While investigating, however, I noticed that most of the Redux selectors in this directory were only referenced by each other and by tests - it seems they were used at some point (they're in use in the initial commit) but were progressively removed by refactorings. Since selectors only serve to encapsulate and reuse logic to lookup data from the Redux store[1], they are not useful when not imported. As such, take this opportunity to remove the dead code.


[1] https://redux.js.org/usage/deriving-data-selectors

Some of the inconsistency of coverage results is due to randomly
generated test data in trace.test.js. While investigating, however, I
noticed that most of the Redux selectors in this directory were only
referenced by each other and by tests - it seems they were used at some
point (they're in use in the initial commit) but were progressively
removed by refactorings. Since selectors only serve to encapsulate and
reuse logic to lookup data from the Redux store[1], they are not useful
when not imported. As such, take this opportunity to remove the dead
code.

---
[1] https://redux.js.org/usage/deriving-data-selectors

Signed-off-by: Máté Szabó <mszabo@fandom.com>
@codecov
Copy link

codecov bot commented Mar 18, 2023

Codecov Report

Patch coverage has no change and project coverage change: +0.05 🎉

Comparison is base (8bd2374) 95.44% compared to head (dcdde4f) 95.50%.

❗ Current head dcdde4f differs from pull request most recent head 5d2cd36. Consider uploading reports for the commit 5d2cd36 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1284      +/-   ##
==========================================
+ Coverage   95.44%   95.50%   +0.05%     
==========================================
  Files         244      243       -1     
  Lines        7753     7627     -126     
  Branches     2016     2002      -14     
==========================================
- Hits         7400     7284     -116     
+ Misses        353      343      -10     
Impacted Files Coverage Δ
packages/jaeger-ui/src/selectors/span.js 100.00% <ø> (+11.42%) ⬆️
packages/jaeger-ui/src/selectors/trace.js 92.30% <ø> (+0.92%) ⬆️

... and 2 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@mszabo-wikia
Copy link
Contributor Author

The other file where coverage changes randomly between local test runs is https://github.com/jaegertracing/jaeger-ui/blob/main/packages/jaeger-ui/src/components/TracePage/TraceStatistics/tableValues.tsx. Not yet sure why.

@yurishkuro
Copy link
Member

it seems they were used at some point (they're in use in the initial commit) but were progressively removed by refactorings

Any idea what would compel people to change away from using selectors? Do you think it's just general unawareness that they exist?

@yurishkuro yurishkuro merged commit b28c849 into jaegertracing:main Mar 18, 2023
@mszabo-wikia
Copy link
Contributor Author

Looks like #68 was the PR that removed most usages, it shifted part of the state management into duck.js (duck.tsx). There isn't much context specifically why though.

Binrix pushed a commit to Binrix/jaeger-ui that referenced this pull request Apr 18, 2023
## Which problem is this PR solving?
- Contributes towards making coverage reports more consistent

## Short description of the changes
Some of the inconsistency of coverage results is due to randomly
generated test data in trace.test.js. While investigating, however, I
noticed that most of the Redux selectors in this directory were only
referenced by each other and by tests - it seems they were used at some
point (they're in use in the initial commit) but were progressively
removed by refactorings. Since selectors only serve to encapsulate and
reuse logic to lookup data from the Redux store[1], they are not useful
when not imported. As such, take this opportunity to remove the dead
code.

---
[1] https://redux.js.org/usage/deriving-data-selectors

Signed-off-by: Máté Szabó <mszabo@fandom.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.

None yet

2 participants