Skip to content

Commit

Permalink
Merge branch 'canary' into fix/blockset-issue-1633
Browse files Browse the repository at this point in the history
  • Loading branch information
josephfusco committed Nov 28, 2023
2 parents cfd6db9 + 2559958 commit 653a8fa
Show file tree
Hide file tree
Showing 21 changed files with 462 additions and 81 deletions.
5 changes: 5 additions & 0 deletions .changeset/four-books-invent.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@faustwp/wordpress-plugin': patch
---

Fixed a bug that caused links to files in wp-content to be rewritten to the Faust Front-end site URL when they should not have been.
5 changes: 5 additions & 0 deletions .changeset/smooth-cooks-warn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@faustwp/wordpress-plugin': patch
---

Bug Fix: Fixed missing call to autosave when using Post/Page previews.
5 changes: 5 additions & 0 deletions .changeset/yellow-foxes-complain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@faustwp/wordpress-plugin': patch
---

Fixed a bug where links were rewritten to the Faust Front-end Site URL when using the post editor, resulting in those rewritten links being saved to the post content and guid fields when they shouldn't be. These links are now saved with the URL pointing to the WP site, as they should be. They are still rewritten at runtime to link to the Front-end Site URL when appropriate.
2 changes: 1 addition & 1 deletion examples/next/app-router/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"@apollo/experimental-nextjs-app-support": "^0.5.1",
"@faustwp/cli": "^1.2.0",
"@faustwp/core": "^1.2.0",
"@faustwp/experimental-app-router": "^0.2.0",
"@faustwp/experimental-app-router": "^0.2.1",
"graphql": "^16.7.1",
"next": "^14.0.1",
"react": "^18.3.0-canary-ce2bc58a9-20231102",
Expand Down
2 changes: 1 addition & 1 deletion examples/next/faustwp-getting-started/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"@apollo/client": "^3.6.6",
"@faustwp/cli": "^1.2.0",
"@faustwp/core": "^1.2.0",
"@wordpress/base-styles": "^4.26.0",
"@wordpress/base-styles": "^4.36.0",
"@wordpress/block-library": "^7.19.0",
"classnames": "^2.3.1",
"graphql": "^16.6.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/next/getting-started/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"react": "^17.0.2",
"react-dom": "^17.0.2",
"sass": "^1.54.0",
"sharp": "^0.30.5"
"sharp": "^0.32.6"
},
"devDependencies": {
"@gqty/cli": "^3.1.0",
Expand Down
155 changes: 142 additions & 13 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"build:faust-cli": "npm run build --workspace=@faustwp/cli",
"build:faust-core": "npm run build --workspace=@faustwp/core",
"build:faust-blocks": "npm run build --workspace=@faustwp/blocks",
"build:experimentala-app-router": "npm run build --workspace=@faustwp/experimental-app-router",
"build:experimental-app-router": "npm run build --workspace=@faustwp/experimental-app-router",
"clean": "npm run clean --workspace=@faustjs/core --workspace=@faustjs/react --workspace=@faustjs/next --workspace=@faustwp/cli --workspace=@faustwp/core --workspace=@faustwp/experimental-app-router --workspace=@faustwp/block-editor-utils",
"clean:examples": "rimraf examples/**/node_modules",
"format": "npm run format --workspace=@faustjs/core --workspace=@faustjs/react --workspace=@faustjs/next --workspace=@faustwp/cli --workspace=@faustwp/core --workspace=@faustwp/experimental-app-router --workspace=@faustwp/block-editor-utils",
Expand All @@ -54,7 +54,7 @@
"version": "changeset version && node scripts/versionPlugin.js",
"version:nightly": "changeset version --snapshot && node scripts/versionPlugin.js",
"version:status": "changeset status",
"release": "npm run build && changeset publish",
"release": "npm run build && npm run build:experimental-app-router && changeset publish",
"release:nightly": "npm run build && changeset publish --tag canary",
"lint": "eslint ./packages --ext js,jsx,ts,tsx --max-warnings=0",
"lint:fix": "eslint ./packages --ext js,jsx,ts,tsx --max-warnings=0 --fix"
Expand Down
6 changes: 6 additions & 0 deletions packages/experimental-app-router/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @faustwp/experimental-app-router

## 0.2.1

### Patch Changes

- 6276c80: Fix broken build from 0.2.0

## 0.2.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/experimental-app-router/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@faustwp/experimental-app-router",
"version": "0.2.0",
"version": "0.2.1",
"description": "Experimental: A Faust package to support Next.js' App Router",
"exports": {
".": "./dist/index.js",
Expand Down
1 change: 1 addition & 0 deletions packages/faustwp-core/src/getProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export async function getNextStaticProps<TProps>(
if (isBoolean(notFound) && notFound === true) {
return {
notFound,
revalidate: DEFAULT_ISR_REVALIDATE,
};
}

Expand Down
21 changes: 12 additions & 9 deletions packages/faustwp-core/src/getWordPressProps.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ function isSSR(
return (ctx as GetServerSidePropsContext).req !== undefined;
}

const createNotFound = (
ctx: GetStaticPropsContext,
revalidate?: number | boolean,
) => ({
notFound: true as const,
...(!isSSR(ctx) && { revalidate: revalidate ?? DEFAULT_ISR_REVALIDATE }),
});

export type WordPressTemplate = React.FC & {
query?: DocumentNode;
variables?: (
Expand Down Expand Up @@ -54,6 +62,7 @@ export async function getWordPressProps(
}
| {
notFound: true;
revalidate?: number | boolean | undefined;
}
> {
const { templates } = getConfig();
Expand Down Expand Up @@ -84,9 +93,7 @@ export async function getWordPressProps(
}) as string | null;

if (!resolvedUrl) {
return {
notFound: true,
};
return createNotFound(ctx, revalidate);
}

const seedQuery = hooks.applyFilters('seedQueryDocumentNode', SEED_QUERY, {
Expand All @@ -104,9 +111,7 @@ export async function getWordPressProps(
debugLog(`Seed Node for resolved url: "${resolvedUrl}": `, seedNode);

if (!seedNode) {
return {
notFound: true,
};
return createNotFound(ctx, revalidate);
}

infoLog(
Expand All @@ -117,9 +122,7 @@ export async function getWordPressProps(
const template = getTemplate(seedNode, templates);

if (!template) {
return {
notFound: true,
};
return createNotFound(ctx, revalidate);
}

let templateQueryRes;
Expand Down
2 changes: 1 addition & 1 deletion packages/faustwp-core/tests/getProps.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe('getProps', () => {
expect.assertions(1);
expect(
await getNextStaticProps({}, { Page: {}, notFound: true }),
).toStrictEqual({ notFound: true });
).toStrictEqual({ notFound: true, revalidate: 900 });
});

test('getNextStaticProps() handles `redirect`', async () => {
Expand Down
Loading

0 comments on commit 653a8fa

Please sign in to comment.