-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
fix: disabled same url check for redirect in logs explorer #7187
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Looks good to me! Reviewed everything up to 84c61f8 in 1 minute and 14 seconds
More details
- Looked at
59
lines of code in2
files - Skipped
0
files when reviewing. - Skipped posting
6
drafted comments based on config settings.
1. frontend/src/hooks/useSafeNavigate.ts:86
- Draft comment:
Nice work adding an option to disable the same URL check. Ensure that tests cover both enabled and disabled scenarios. - Reason this comment was not posted:
Confidence changes required:33%
<= threshold50%
None
2. frontend/src/hooks/useSafeNavigate.ts:117
- Draft comment:
Good conditional check based onenableSameURLCheck
. Double-check if other parts of URL comparison need similar flexibility. - Reason this comment was not posted:
Confidence changes required:20%
<= threshold50%
None
3. frontend/src/providers/QueryBuilder.tsx:766
- Draft comment:
PassingenableSameURLCheck
as a function of the data source is a clear solution for logs explorer redirection. - Reason this comment was not posted:
Confidence changes required:20%
<= threshold50%
None
4. frontend/src/hooks/useSafeNavigate.ts:86
- Draft comment:
Good implementation: the new enableSameURLCheck parameter defaults to true and is correctly used in the safeNavigate callback. The dependency array now includes enableSameURLCheck, ensuring that its changes are respected. Consider adding a brief comment or JSDoc note explaining its usage. - Reason this comment was not posted:
Confidence changes required:0%
<= threshold50%
None
5. frontend/src/providers/QueryBuilder.tsx:766
- Draft comment:
The safeNavigate hook is now invoked with enableSameURLCheck disabled when initialDataSource equals DataSource.LOGS, which fits the logs explorer fix. Make sure that initialDataSource updates appropriately to reflect the logs data source when needed. - Reason this comment was not posted:
Confidence changes required:0%
<= threshold50%
None
6. frontend/src/providers/QueryBuilder.tsx:169
- Draft comment:
Typo: The variable name 'setupedQueryData' is misspelled. Consider renaming it to 'setupQueryData' or 'preparedQueryData' for improved clarity. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
Workflow ID: wflow_lB64EAMdqKRhLnC0
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
@@ -763,7 +763,9 @@ export function QueryBuilderProvider({ | |||
[panelType, stagedQuery], | |||
); | |||
|
|||
const { safeNavigate } = useSafeNavigate(); | |||
const { safeNavigate } = useSafeNavigate({ | |||
enableSameURLCheck: !(initialDataSource === DataSource.LOGS), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have we checked the same on traces page? Why only logs here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now, just did for logs. After Shaheer shares his reasoning for the same change. Will either remove the whole check or add the flag from required sources.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -78,7 +82,9 @@ const isDefaultNavigation = (currentUrl: URL, targetUrl: URL): boolean => { | |||
|
|||
return newKeys.length > 0; | |||
}; | |||
export const useSafeNavigate = (): { | |||
export const useSafeNavigate = ( | |||
{ enableSameURLCheck }: UseSafeNavigateProps = { enableSameURLCheck: true }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we slightly change this to make it more readable?
e.g.
we can change this to
{ preventSameUrlNavigation }: UseSafeNavigateProps = { preventSameUrlNavigation: true },
if we want to enable same url navigation in the consumers. we could say
const { safeNavigate } = useSafeNavigate({
preventSameUrlNavigation: false,
});
Summary
Related Issues / PR's
Screenshots
NA
Affected Areas and Manually Tested Areas
Important
Adds option to disable same URL check in
useSafeNavigate
and applies it to LOGS data source inQueryBuilderProvider
.enableSameURLCheck
option touseSafeNavigate
inuseSafeNavigate.ts
to control same URL navigation check.QueryBuilder.tsx
, disables same URL check for LOGS data source by passingenableSameURLCheck: false
touseSafeNavigate
.useSafeNavigate
to acceptUseSafeNavigateProps
withenableSameURLCheck
defaulting totrue
.safeNavigate
function to respectenableSameURLCheck
flag.useSafeNavigate
hook to includeenableSameURLCheck
.This description was created by
for 84c61f8. It will automatically update as commits are pushed.