Wrap identifiers/call expressions that are passed as the 2nd parameter
to createServerFn with a function expression whose body is prepended
with the "use server" directive.
This allows for functions that are passed to createServerFn to be
wrapped with other functions that server as middleware.
router-vite-plugin/tests/test-files/createServerFn.tsx has a Zod
middleware function example which has the "use server" directive
properly prepended.
* test(react-router): adjust the test names to accomodate the on-navigate stuff
* test(react-router): breaking route context
* test(react-router): test cases for redirects breaking
* test(react-router): use a bit more sleep
* test(react-router): a bit clearer on whats being tested
* test(react-router): check the `window.location.pathname` in the tests
* fix(react-router): a single test is now working, dont know what that means
* test: make sure StrictMode is ON
* test(react-router): this is no longer needed since we are doing this in routeContext.test.tsx
* test(react-router): confirm StrictMode on
* test(react-router): adjust the test names to accomodate the on-navigate stuff
* test(react-router): breaking route context
* test(react-router): test cases for redirects breaking
* test(react-router): use a bit more sleep
* test(react-router): a bit clearer on whats being tested
* test(react-router): check the `window.location.pathname` in the tests
* fix(react-router): a single test is now working, dont know what that means
* test: make sure StrictMode is ON
* test(react-router): this is no longer needed since we are doing this in routeContext.test.tsx
* test(react-router): confirm StrictMode on
* test: wrap fireEvent calls in `act`
* chore: readability
* fix: i dont know why, but this fixes the tests
* test: turn these back on
* fix: lets not change too much
* fix: bit closer to what it was before
* chore: not over updating
reducing the updates like @freshgiammi PR
* test(react-router): route context breaking for layout routes
* test(react-router): cases testing route context in layout routes for `beforeLoad`, `loader`, and `useRouteContext`
* chore: use the useRouteContext hook from the route definition
* chore: mistake in the test
* test: wrap the render calls in `act`
* test: wrap createRouter in `act`
* test: remove magic sleeps
* test: nested routes
* test: loaders
* test: failing tests for the loaders
* test: react strictmode for loaders
* test: dont use `waitFor` rather wait for elements in the DOM
* test: more async-work delayed checking of route context
* test: add an invalidate call after
* fix: remove the recursive `this.load()` call
The patch implemented by @freshgiammi in #1662
Co-Authored-By: Gianmarco Rengucci <16855748+freshgiammi@users.noreply.github.com>
* refactor: restore the `checkLatest()` call here
* test: remove these tests for routeContext in redirects
---------
Co-authored-by: Gianmarco Rengucci <16855748+freshgiammi@users.noreply.github.com>
* fix: route masking, preload and index routes for `from` invariant checkout
- routesByPath doesn't include branches, they are deduped with index routes
therefor I am using flatRoutes
- preload redirects should not include from automatically as it should be explicit
- declarative route masking should be pass from because from for route masking does
not assert a location
* tests: add tests for search params
* fix: allow trailing slashes by using matchpathname and use _fromLocation for preloading and beforeLoad
* fix: ensure that trailingSlashes don't break path matching
* chore: this wasn't on purpose
* fix: make `removeTrailingSlash` account for basepath
* test: tests for basepath
* refactor: consolidate how we handle basepath replacing
* test: matrix tests with different basepaths for utils
* refactor: revert basereplace
* test(react-router): check in component-land about redirects
* test(react-router): do the same for the beforeLoad and loader spots
* chore: whoops
* test: make sure the pathnames are checked
* test(react-router): initial tests for checking the route context
* chore: some comments so I know where I'm at
* test(react-router): make sure that context modification works
* chore: remove the element ids to simplify things
* chore: use simple naming for this stuff
* test(react-router): making sur the mock fn is only called once
* fix: `from` was being ignored when the pathname included params or a pathless route
* tests: change description of test to match current location
* fix: apply changes to useNavigate and redirect, also add more tests
* chore: inline looseRoutesByPath
* Run server within Github CI
* Give unique package name
* Set proper shas for affected packages
* Move start server command to playwright config
* Remove test:e2e
* Move up replay installation, remove `test:e2e` script
* Add e2e targets
* Empty commit
* Empty commit
* Hardcode public version of REPLAY_API_KEY secret
* feat: merge context, params, search and loaderData when `strict` is false
- objects in context, params, search and loaderData will be merged into object with all properties optional.
- if objects contain conflicting properties they are resolved with unions
- if some unions contain primitives, tuples or arrays they are ignored and are a part of a union
* chore: use `undefined` instead of `{}` for default TLoaderData