Refactor(ui): Remove deprecated history typing from withRouteProps#3452
Refactor(ui): Remove deprecated history typing from withRouteProps#3452aryanG9403 wants to merge 8 commits intojaegertracing:mainfrom
Conversation
Signed-off-by: Aryan Ghotekar <aryanghotekar95@gmail.com>
9d1cf67 to
f03a6da
Compare
Signed-off-by: Aryan Ghotekar <aryanghotekar95@gmail.com>
Signed-off-by: Aryan Ghotekar <aryanghotekar95@gmail.com>
Head branch was pushed to by a user without write access
|
Added a follow-up commit to update the withRouteProps test expectations so they match the current React Router behavior. This fixes the failing unit test. |
| pathname={pathname} | ||
| search={search} | ||
| params={params} | ||
| history={history} |
There was a problem hiding this comment.
So we're no longer passing history, how is it not a breaking change? THIS file may not need history but we have no idea if the WrappedComponent needs it.
There was a problem hiding this comment.
The test update was meant to reflect the current behavior of withRouteProps, which no longer injects history now that routing is handled via hooks.That said, I agree this HOC could still be used by components that expect history, so removing it may be a breaking change depending on usage.
I’m happy to update this in either direction:
- keep passing history for backward compatibility, or
- clarify and/or deprecate the behavior explicitly if that’s the intended direction.
Let me know what you’d prefer and I’ll adjust accordingly.
There was a problem hiding this comment.
LGTM 👍
10 components using withRouteProps: 8 of them don't use history and 2 are getting history from other sources. I have tested some and they working properly.
Also the main reason why it does not breaking any functionality is the current routing setup:
from src/index.tsx:
<Router history={history}>
<CompatRouter>
<JaegerUIApp />
</CompatRouter>
</Router>
@yurishkuro could you please review it once more? these changes can sometime be breaking and thy are sometime difficult to catch.
Parship12
left a comment
There was a problem hiding this comment.
I found another issue:
there is a buggy code in packages/jaeger-ui/src/components/TracePage/index.tsx
ensureTraceFetched(): Uppercase URLs stay uppercase because the code exits early before normalizing. After fixing the uppercase bug in my local revealed that withRouteProps is not providing history.
|
Thanks for flagging this 👍 |
|
I asked Claude to analyze the existing usage, it came back with two issues: Summary8 out of 10 components are completely safe — they don't use
2 components currently use
ProblemsThe if (navigate) {
navigate({ pathname, search }, { replace: true });
} else if (history) {
history.replace({ ...location, search });
} However, if history is removed from withRouteProps without updating these two components to pass navigate instead, the updateUiFind calls will effectively become no-ops (neither branch executes), and history.replace() in ensureTraceFetched() will throw a runtime error. RecommendationBefore merging, verify one of the following:
|
|
Thanks for the detailed analysis — that’s very helpful. Will push an update shortly. |
this was done in #3209 for backward compatibility (so that the refactoring can be done properly and incrementally)
Yes this is related to the issue the I stated above and in #3477
Option 1 will be better, should be done in different PRs |
|
Thanks for the clarification , |
|
@Parship12 already had a PR for virtualized view #3223. So does TracePage - #3435. You could help by reviewing & testing those PRs. |
|
@aryanG9403 Are you still working on this? Is there any update? |
|
Hey @Parship12! Currently waiting on:
I have already reviewed and tested PR #3435 locally on Ubuntu Once both PRs are in, #3452 should be ready to merge. |
could you please continue the refactoring in a new PR, maybe using the review comments from that PR as a reference?
Thanks! could you also help with the code review part? |
|
SURE👍 |
|
Hi! @Parship12 , However, #3551 is currently on hold due to the contributor PR quota limit. I'll also be doing a proper code review of #3435 shortly. One question — once #3551 and #3435 are reviewed and approved, what would be the process to get them merged before #3452? Since #3452 depends on both of them landing first. |
|
Thanks @Parship12 ! , could you help by reviewing #3551? It's currently on hold due to the quota limit but all tests are passing and all Copilot review comments have been addressed. That would help unblock the whole chain! |
Signed-off-by: Aryanghotekar <145753436+aryanG9403@users.noreply.github.com>
|
Hi @yurishkuro , resolved the merge conflict with main. The PR is now up to date. Could you please re-review when you get a chance? |
Signed-off-by: Aryanghotekar <145753436+aryanG9403@users.noreply.github.com>
|
Hello @aryanG9403 thanks for your contribution. We have already completed the history removal. I was not able to follow this PR closely since i handled both the history removal and the React router dom v7 upgrade together. |
Which problem is this PR solving?
Description of the changes
Historytype usage fromwithRoutePropsIWithRoutePropsto rely only onuseLocationanduseParamsHow was this change tested?
yarn lintChecklist
jaeger-ui:yarn lint