Commit Graph

3 Commits

Author SHA1 Message Date
JJ Kasper bdf82000a8 Add additional handling for experimental tracing (#67785)
This adds additional trace handling under the experimental trace mode.
Outside of the feature flag the bloom filter for app router paths used
in pages to hard navigate was updated to no longer be inlined by default
with webpack to avoid invalidating the main bundle for pages too often.
Instead the bloom filter data is stored in the `_buildManifest` file
which is only used in the pages router and is easier to update as it's
per-build already.

This tracing feature is still very experimental and should not be
leveraged in production or outside of testing.

---------

Co-authored-by: Zack Tanner <1939140+ztanner@users.noreply.github.com>
2024-07-17 14:10:02 -07:00
Jiachi Liu 484f4724f4 Separate navigation and hooks tests into new test suites (#45766)
Moving tests to reduce app-dir/app/index.test.ts running duration
2023-02-10 00:38:39 +00:00
Wyatt Johnson 6c7e76b551 Hybrid App Hooks Support (#41767)
This adapts the new client hooks of `usePathname`, `useSearchParams`,
and `useRouter` to work within the `pages/` directory to aid users
attempting to migrate shared components over to the `app/` directory.

> **Exception:**
> When the pages router is not ready, `useSearchParams` will return an
empty `URLSearchParams`. This mirrors the behavior seen in the `pages/`
directory today in that `router.query` is not available until the client
hydrates.

This also adds a new option for `useRouter` to bring it line with the
correct typings with the app directory. By default, calling
`useRouter()` will return the type `NextRouter | null` to represent what
you get when you call it from a component originating from the app
directory. If you want to instead force it to return `NextRouter` as it
does today, you can pass a boolean into the `useRouter` call as such:

```ts
const router = useRouter()     // typeof router === NextRouter | null
const router = useRouter(true) // typeof router === NextRouter
```

This change is designed to ease the incremental adoption of app.
2022-10-31 20:13:27 -07:00