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

fix: useNavigationItems now accepts options #191

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/many-colts-roll.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@squide/firefly": patch
---

`useNavigationItems` now accepts `useRuntimeNavigationItems` options.
12 changes: 12 additions & 0 deletions .changeset/thirty-chairs-own.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
"@squide/react-router": patch
"@squide/core": patch
"@squide/fakes": patch
"@squide/firefly-webpack-configs": patch
"@squide/i18next": patch
"@squide/module-federation": patch
"@squide/msw": patch
"@squide/webpack-configs": patch
---

Updated packages description.
2 changes: 1 addition & 1 deletion .github/workflows/changeset.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: ">=20.0.0"
node-version: ">=21.1.0"
check-latest: true,
cache: pnpm

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: ">=20.0.0"
node-version: ">=21.1.0"
check-latest: true,
cache: pnpm

Expand Down
6 changes: 3 additions & 3 deletions packages/firefly/src/useNavigationItems.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useRuntimeNavigationItems } from "@squide/react-router";
import { useRuntimeNavigationItems, type UseRuntimeNavigationItemsOptions } from "@squide/react-router";
import { useAppRouterState } from "./AppRouterContext.ts";

export function useNavigationItems() {
export function useNavigationItems(options?: UseRuntimeNavigationItemsOptions) {
// This is not the most sophisticated strategy but it seems to be good enough for now.
// The idea is that when deferred registrations are used by the consumer applications, the deferred registrations could
// be updated when the global data is updated. If the deferred registrations are updated, it means that the registered
Expand All @@ -12,5 +12,5 @@ export function useNavigationItems() {
// even introducing new module states.
useAppRouterState();

return useRuntimeNavigationItems();
return useRuntimeNavigationItems(options);
}
4 changes: 2 additions & 2 deletions packages/react-router/src/useRuntimeNavigationItems.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { useRuntime } from "@squide/core";
import type { ReactRouterRuntime } from "./reactRouterRuntime.ts";

export interface UseNavigationItemsOptions {
export interface UseRuntimeNavigationItemsOptions {
menuId?: string;
}

// This hook has been renamed from useNavigationItems to useRuntimeNavigationItems to free up the name for the
// use useNavigationItems hook of the @squide/firefly package.
export function useRuntimeNavigationItems({ menuId }: UseNavigationItemsOptions = {}) {
export function useRuntimeNavigationItems({ menuId }: UseRuntimeNavigationItemsOptions = {}) {
const runtime = useRuntime() as ReactRouterRuntime;

return runtime.getNavigationItems(menuId);
Expand Down
1,021 changes: 172 additions & 849 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions samples/basic/host/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"@react-stately/toast": "3.0.0-beta.4",
"@squide/fakes": "workspace:*",
"@squide/firefly": "workspace:*",
"@tanstack/react-query": "5.51.9",
"react": "18.3.1",
"react-dom": "18.3.1",
"react-router-dom": "6.25.1",
Expand Down
2 changes: 1 addition & 1 deletion samples/endpoints/host/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
"@squide/firefly-webpack-configs": "workspace:*",
"@swc/core": "1.7.0",
"@swc/helpers": "0.5.12",
"@tanstack/react-query": "5.51.9",
"@types/react": "18.3.3",
"@types/react-dom": "18.3.0",
"@workleap/browserslist-config": "2.0.1",
Expand Down Expand Up @@ -47,6 +46,7 @@
"@squide/fakes": "workspace:*",
"@squide/firefly": "workspace:*",
"@squide/i18next": "workspace:*",
"@tanstack/react-query": "5.51.9",
"i18next": "23.12.1",
"i18next-browser-languagedetector": "8.0.0",
"msw": "2.3.1",
Expand Down