Skip to content

Commit

Permalink
feat(next-drupal)!: add App Router support for Server Components
Browse files Browse the repository at this point in the history
Fixes #442

BREAKING CHANGE:

The useMenu() client hook has moved out of the main entry point and into its own
entry point. Any import or require of that function needs to be updated:

Old usage:
```js
import { useMenu } from "next-drupal"
```

New usage:
```js
import { useMenu } from "next-drupal/navigation"
```
  • Loading branch information
JohnAlbin committed Nov 15, 2023
1 parent 9d5d410 commit 2dc4bcf
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
15 changes: 14 additions & 1 deletion packages/next-drupal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
"description": "Helpers for Next.js + Drupal.",
"version": "1.6.0",
"sideEffects": false,
"source": "src/index.ts",
"source": [
"src/index.ts",
"src/navigation.ts"
],
"type": "module",
"main": "dist/index.cjs",
"module": "dist/index.modern.js",
Expand All @@ -17,6 +20,16 @@
"types": "./dist/index.d.cts",
"default": "./dist/index.cjs"
}
},
"./navigation": {
"import": {
"types": "./dist/navigation.d.ts",
"default": "./dist/navigation.modern.js"
},
"require": {
"types": "./dist/navigation.d.cts",
"default": "./dist/navigation.cjs"
}
}
},
"types": "dist/index.d.ts",
Expand Down
1 change: 0 additions & 1 deletion packages/next-drupal/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ export * from "./get-resource"
export * from "./get-search-index"
export * from "./get-view"
export * from "./types"
export * from "./use-menu"
export * from "./translate-path"
export {
deserialize,
Expand Down
1 change: 1 addition & 0 deletions packages/next-drupal/src/navigation.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { useMenu } from "./navigation/use-menu"
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useRouter } from "next/router"
import { useEffect, useState } from "react"
import { getMenu } from "./get-menu"
import type { DrupalMenuLinkContent } from "./types"
import { getMenu } from "../get-menu"
import type { DrupalMenuLinkContent } from "../types"

export function useMenu<T extends DrupalMenuLinkContent>(
name: string
Expand Down

0 comments on commit 2dc4bcf

Please sign in to comment.