create-nextblock 0.13.2 → 0.13.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-nextblock",
3
- "version": "0.13.2",
3
+ "version": "0.13.3",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -490,14 +490,26 @@ function getProductFieldEditorComponent(target: VisualEditingProductFieldTarget)
490
490
  }
491
491
 
492
492
  export function NextblockVisualEditing() {
493
- const router = useRouter();
494
493
  const pathname = usePathname();
495
494
 
496
- // If we are on a CMS edit or admin page, hide the frontend toolbar entirely to prevent overlap.
495
+ // Hide the frontend toolbar on CMS/admin routes. This MUST stay a thin wrapper
496
+ // that renders the real toolbar as a child rather than early-returning after the
497
+ // toolbar's hooks: this component is mounted in the root layout and persists
498
+ // across client navigations, so if the ~25 hooks below lived here, navigating
499
+ // from a public page (where they all run while editing a draft) into /cms would
500
+ // drop every hook at once — a rules-of-hooks violation that throws mid-navigation
501
+ // and forces a full page reload. Mounting/unmounting a child is safe; changing a
502
+ // component's own hook count between renders is not.
497
503
  if (pathname?.startsWith("/cms")) {
498
504
  return null;
499
505
  }
500
506
 
507
+ return <VisualEditingToolbar />;
508
+ }
509
+
510
+ function VisualEditingToolbar() {
511
+ const router = useRouter();
512
+
501
513
  const [hoverTarget, setHoverTarget] = useState<HoverTarget | null>(null);
502
514
  const [activeInfo, setActiveInfo] = useState<NextblockVisualEditInfo | null>(null);
503
515
  const [activeDocument, setActiveDocument] = useState<ActiveDocument | null>(null);
@@ -1,6 +1,6 @@
1
1
  /// <reference types="next" />
2
2
  /// <reference types="next/image-types/global" />
3
- import "./.next/types/routes.d.ts";
3
+ import "./.next/dev/types/routes.d.ts";
4
4
 
5
5
  // NOTE: This file should not be edited
6
6
  // see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nextblock-cms/template",
3
- "version": "0.13.2",
3
+ "version": "0.13.3",
4
4
  "private": true,
5
5
  "scripts": {
6
6
  "dev": "next dev",