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

fix: issue while switching between views #6200

Conversation

ahmadshaheer
Copy link
Collaborator

@ahmadshaheer ahmadshaheer commented Oct 16, 2024

Summary

the root cause of #6187 was, using useUrlQuery to get the current URL's search params, we used to get the stale viewName, therefore, it would update the selectColumns with the old viewName being selected. thus it would keep the old view selected.

by creating URLSearchParams inside the redirectWithQuery, we ensure that we're working with the most up-to-date URL state.

Related Issues / PR's

close #6187
close https://github.com/SigNoz/engineering-pod/issues/1913

Screenshots

NA

Affected Areas and Manually Tested Areas

Affecter areas:

  • Logs
  • Traces

Tested:

  • switching between saved views in logs explorer
  • switching between saved views in traces explorer
  • creating a new view and switching to another view in logs explorer
  • creating a new view and switching to another view in traces explorer

Important

Fixes URL query handling in useUrlQueryData by using URLSearchParams for up-to-date query state and corrects import path for useUrlQuery.

  • Behavior:
    • Fixes URL query handling in useUrlQueryData by using URLSearchParams to ensure up-to-date query state.
    • Updates redirectWithQuery to construct URLs with current pathname and updated query string.

This description was created by Ellipsis for 88c3fa8. It will automatically update as commits are pushed.

@ahmadshaheer ahmadshaheer linked an issue Oct 16, 2024 that may be closed by this pull request
@ahmadshaheer ahmadshaheer marked this pull request as draft October 16, 2024 09:15
Copy link

Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id>

@github-actions github-actions bot added the bug Something isn't working label Oct 16, 2024
Copy link

Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id>

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a 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 34a4028 in 18 seconds

More details
  • Looked at 40 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 2 drafted comments based on config settings.
1. frontend/src/container/ExplorerOptions/ExplorerOptions.tsx:352
  • Draft comment:
    The order of function calls in handleSelect has been changed. Ensure that updatePreservedViewInLocalStorage and updateOrRestoreSelectColumns are intended to be called before onMenuItemSelectHandler. This change seems logical as it updates the local storage and restores columns before handling the menu item selection.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The PR changes the order of function calls in handleSelect. This change is logical because it updates the local storage and restores columns before handling the menu item selection, which seems to be the intended behavior.
2. frontend/src/container/ExplorerOptions/ExplorerOptions.tsx:349
  • Draft comment:
    Avoid using inline styles in React components. Consider using external stylesheets, CSS classes, or styled components instead. This applies to other inline styles in this file as well.
  • Reason this comment was not posted:
    Comment was on unchanged code.

Workflow ID: wflow_jHIk9orPcW6GoUY2


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

@ahmadshaheer ahmadshaheer force-pushed the 6187-selecting-view-in-explorer-options-does-not-switch-to-view branch from 34a4028 to 0319da3 Compare October 16, 2024 13:01
@ahmadshaheer ahmadshaheer marked this pull request as ready for review October 16, 2024 14:07
Copy link

Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id>

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a 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 0319da3 in 17 seconds

More details
  • Looked at 44 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 4 drafted comments based on config settings.
1. frontend/src/hooks/useUrlQueryData.ts:4
  • Draft comment:
    Consider using consistent import paths throughout the codebase. The import path for useUrlQuery was changed from an absolute to a relative path. Ensure this is consistent with other imports.
  • Reason this comment was not posted:
    Confidence changes required: 20%
    The import statement for useUrlQuery was changed from a relative path to an absolute path, which is a minor change but should be consistent with the rest of the codebase.
2. frontend/src/hooks/useUrlQueryData.ts:14
  • Draft comment:
    The order of dependencies in the useMemo hook was changed. Ensure this order is consistent with other similar hooks in the codebase.
  • Reason this comment was not posted:
    Confidence changes required: 20%
    The useMemo dependency array was reordered, which is a minor change but should be consistent with the rest of the codebase.
3. frontend/src/hooks/useUrlQueryData.ts:35
  • Draft comment:
    The useCallback dependency array was modified to remove urlQuery. Ensure this change does not affect the expected behavior of the redirectWithQuery function.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The useCallback dependency array was updated to remove urlQuery, which is a significant change. This could affect the behavior of the redirectWithQuery function.
4. frontend/src/hooks/useUrlQueryData.ts:1
  • Draft comment:
    Avoid using the component/index.tsx file structure approach, as it makes it difficult to debug and find components using global search tools like VS Code. Ensure that the file structure is clear and components are easily searchable.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The code does not violate any of the specified rules. It uses hooks and does not involve any design tokens, inline styles, or ClickHouseReader interface issues.

Workflow ID: wflow_uSKP9VbRfAukCWmR


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a 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! Incremental review on 88c3fa8 in 15 seconds

More details
  • Looked at 24 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. frontend/src/hooks/useUrlQueryData.ts:27
  • Draft comment:
    Consider using location.search instead of window.location.search for consistency with the location object from useLocation().
  • Reason this comment was not posted:
    Comment was on unchanged code.

Workflow ID: wflow_yH6g6PJUhqDGon8S


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

@YounixM YounixM merged commit c206f4f into develop Oct 28, 2024
17 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Selecting view in explorer-options does not switch to view
4 participants