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

App Router Preview Handler #797

Merged
merged 52 commits into from
Jul 13, 2024
Merged

Conversation

nicholasio
Copy link
Member

@nicholasio nicholasio commented Jul 1, 2024

Description of the Change

Partially addresses #791

How to test the Change

  • npm install
  • npm run dev:app
  • Make sure your wp-env has its Headless URL pointing to http://localhost:3000
  • Visit localhot:8888/wp-admin and preview both draft and published posts.
app-router-preview.mp4

Checklist:

  • I agree to follow this project's Code of Conduct.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests pass.

Copy link
Contributor

github-actions bot commented Jul 4, 2024

📦 Next.js Bundle Analysis for @10up/headstartwp

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

import { previewRouteHandler } from '../previewRouteHandler';

describe('previewRouteHandler', () => {
it.skip('does not accepts POST requests', async () => {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having an issue with fetch where instantiating NextRequest is failling, will look into it afterwards.

@nicholasio nicholasio changed the title Feature/app router preview handler App Router Preview Handler Jul 4, 2024
@nicholasio nicholasio marked this pull request as ready for review July 4, 2024 00:06
Base automatically changed from feature/app-router to develop July 11, 2024 18:53
Copy link
Contributor

📦 Next.js Bundle Analysis for @10up/headstartwp

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

Copy link
Contributor

📦 Next.js Bundle Analysis for @10up/headstartwp

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

<!--
Filling out this template is required. Any PR that does not include
enough information to be reviewed may be closed at a maintainers'
discretion. All new code requires documentation and tests to ensure
against regressions.
-->

### Description of the Change
<!--
We must be able to understand the design of your change from this
description. The maintainer reviewing this PR may not have worked with
this code recently, so please provide as much detail as possible.

Where possible, please also include:
- verification steps to ensure your change has the desired effects and
has not introduced any regressions
- any benefits that will be realized
- any alternative implementations or possible drawbacks that you
considered
- screenshots or screencasts
-->

<!-- Enter any applicable Issue number(s) here that will be
closed/resolved by this PR. -->
Closes #791 



### Checklist:
<!--- Go over all the following points, and put an `x` in all the boxes
that apply. -->
<!--- If you are unsure about any of these, please ask for
clarification. We are here to help! -->
- [x] I agree to follow this project's [**Code of
Conduct**](https://github.com/10up/.github/blob/trunk/CODE_OF_CONDUCT.md).
- [ ] I have updated the documentation accordingly.
- [x] I have added tests to cover my change.
- [x] All new and existing tests pass.
<!--
Filling out this template is required. Any PR that does not include
enough information to be reviewed may be closed at a maintainers'
discretion. All new code requires documentation and tests to ensure
against regressions.
-->

### Description of the Change
<!--
We must be able to understand the design of your change from this
description. The maintainer reviewing this PR may not have worked with
this code recently, so please provide as much detail as possible.

Where possible, please also include:
- verification steps to ensure your change has the desired effects and
has not introduced any regressions
- any benefits that will be realized
- any alternative implementations or possible drawbacks that you
considered
- screenshots or screencasts
-->

<!-- Enter any applicable Issue number(s) here that will be
closed/resolved by this PR. -->
Partially Closes #791 

This also refactors the test infrastructure to use absolute URLs instead
of relative URL (closes #643 )

### How to test the Change
<!-- Please provide steps on how to test or validate that the change in
this PR works as described. -->
- Start up the wp-env
- `npm run build -- --filter=@10up/wp-nextjs-app` to build the app
- `npm run start -w=@10up/wp-nextjs-app` to start the app.
- Make sure to set the headless front-end url in Settings.
- Open any post on the admin interface and update it, ensure that the
post on the front-end gets revalidated (yuou see the updated version)


### Checklist:
<!--- Go over all the following points, and put an `x` in all the boxes
that apply. -->
<!--- If you are unsure about any of these, please ask for
clarification. We are here to help! -->
- [x] I agree to follow this project's [**Code of
Conduct**](https://github.com/10up/.github/blob/trunk/CODE_OF_CONDUCT.md).
- [ ] I have updated the documentation accordingly.
- [ ] I have added tests to cover my change.
- [x] All new and existing tests pass.
packages/core/src/react/hooks/__tests__/useFetchAppSettings.tsx Dismissed Show dismissed Hide dismissed
packages/core/src/react/hooks/__tests__/useFetchPostOrPosts.tsx Dismissed Show dismissed Hide dismissed
packages/core/src/react/hooks/__tests__/useFetchPostOrPosts.tsx Dismissed Show dismissed Hide dismissed
packages/core/src/react/hooks/__tests__/useFetchSearch.tsx Dismissed Show dismissed Hide dismissed
packages/core/src/react/hooks/__tests__/useFetchPost.tsx Dismissed Show dismissed Hide dismissed
packages/next/src/data/hooks/__tests__/usePosts.tsx Dismissed Show dismissed Hide dismissed
packages/next/src/data/hooks/__tests__/useAuthorArchive.tsx Dismissed Show dismissed Hide dismissed
packages/next/src/data/hooks/__tests__/useSearch.tsx Dismissed Show dismissed Hide dismissed
packages/next/src/data/hooks/__tests__/usePrepareFetch.tsx Dismissed Show dismissed Hide dismissed
packages/next/src/data/hooks/__tests__/useTerms.tsx Dismissed Show dismissed Hide dismissed
Copy link
Contributor

📦 Next.js Bundle Analysis for @10up/headstartwp

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

@nicholasio nicholasio merged commit 6fa9ec2 into develop Jul 13, 2024
13 checks passed
@nicholasio nicholasio deleted the feature/app-router-preview-handler branch July 13, 2024 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant