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

ref(issue-views): Replace navigate/location with useSearchParams in issue views components #82875

Closed
wants to merge 1 commit into from

Conversation

MichaelSun48
Copy link
Member

Replaces usages useNavigate, useLocation, and InjectedRouters with RR6s useSearchParams in the issue views components.

Unfortunately, issue views tests relies heavily on using the router to test url query behavior, and there's currently no way to test the same behavior with useSearchParams, hence why this PR is drafted. (related issue)

@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Jan 3, 2025
Copy link

codecov bot commented Jan 6, 2025

❌ 12 Tests Failed:

Tests completed Failed Passed Skipped
8466 12 8454 0
View the top 3 failed tests by shortest run time
IssueViewsHeader CustomViewsHeader initialization and router behavior updates the unsaved changes indicator for a default tab if the query is different
Stack Traces | 0.087s run time
TestingLibraryElementError: Unable to find an element by: [data-test-id="unsaved-changes-indicator"]

Ignored nodes: comments, script, style
...
    at Object.getElementError (.../sentry/sentry/node_modules/@.../dom/dist/config.js:37:19)
    at .../sentry/sentry/node_modules/@.../dom/dist/query-helpers.js:76:38
    at .../sentry/sentry/node_modules/@.../dom/dist/query-helpers.js:52:17
    at .../sentry/sentry/node_modules/@.../dom/dist/query-helpers.js:95:19
    at Object.<anonymous> (.../views/issueList/issueViewsHeader.spec.tsx:288:42)
    at runNextTicks (node:internal/process/task_queues:65:5)
    at processTimers (node:internal/timers:526:9)
IssueViewsHeader CustomViewsHeader query behavior renders the unsaved changes indicator if a viewId and non-matching sort are in the query params
Stack Traces | 0.102s run time
Error: expect(element).toHaveAttribute("aria-selected", "true") // element.getAttribute("aria-selected") === "true"

Expected the element to have attribute:
  aria-selected="true"
Received:
  aria-selected="false"
    at Object.<anonymous> (.../views/issueList/issueViewsHeader.spec.tsx:409:11)
IssueViewsHeader CustomViewsHeader initialization and router behavior allows you to manually enter a query, even if you only have a default tab
Stack Traces | 0.105s run time
Error: expect(element).toHaveAttribute("aria-selected", "true") // element.getAttribute("aria-selected") === "true"

Expected the element to have attribute:
  aria-selected="true"
Received:
  aria-selected="false"
    at Object.<anonymous> (.../views/issueList/issueViewsHeader.spec.tsx:158:11)

To view more test analytics, go to the Test Analytics Dashboard
📢 Thoughts on this report? Let us know!

@getsantry
Copy link
Contributor

getsantry bot commented Jan 28, 2025

This pull request has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you add the label WIP, I will leave it alone unless WIP is removed ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

@getsantry getsantry bot added Stale and removed Stale labels Jan 28, 2025
@MichaelSun48
Copy link
Member Author

Closing since if we're going to do this, we're going to do this with a library that supports type safety, like nuqs.

@github-actions github-actions bot locked and limited conversation to collaborators Feb 28, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Scope: Frontend Automatically applied to PRs that change frontend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant