Closes #9132. When query params are present in the URL, such as after searching or filtering in the list view, they are not being retained after navigating back to that view via `history.back()` (i.e. the back button). This makes it difficult to quickly navigate in and out of documents from the list view when an underlying search exists. This was because the `SearchParamsProvider` is stale when the new view renders, which then replaces the URL with these stale params. The fix here is to _not_ use the `SearchParamsProvider` at all, and instead use `next/navigation` directly. Ultimately, this provider should likely be marked deprecated and then removed in the next major release for this very reason.
17 lines
636 B
TypeScript
17 lines
636 B
TypeScript
import type { Page } from '@playwright/test'
|
|
import type { AdminUrlUtil } from 'helpers/adminUrlUtil.js'
|
|
|
|
export const goToFirstCell = async (page: Page, urlUtil: AdminUrlUtil) => {
|
|
const cellLink = page.locator(`tbody tr:first-child td a`).first()
|
|
const linkURL = await cellLink.getAttribute('href')
|
|
await page.goto(`${urlUtil.serverURL}${linkURL}`)
|
|
await page.waitForURL(`**${linkURL}`)
|
|
}
|
|
|
|
export const navigateToDoc = async (page: Page, urlUtil: AdminUrlUtil) => {
|
|
await page.goto(urlUtil.list)
|
|
const regex = new RegExp(`^${urlUtil.list}(?:\\?.*)?$`)
|
|
await page.waitForURL(regex)
|
|
await goToFirstCell(page, urlUtil)
|
|
}
|