@firecms/core 3.0.0-canary.272 → 3.0.0-canary.274

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.
@@ -42,7 +42,11 @@ export declare class EntityReference {
42
42
  * to the root of the database).
43
43
  */
44
44
  readonly path: string;
45
- constructor(id: string, path: string);
45
+ /**
46
+ * Optional database ID where the entity is stored (if multiple databases are used)
47
+ */
48
+ readonly databaseId?: string;
49
+ constructor(id: string, path: string, databaseId?: string);
46
50
  get pathWithId(): string;
47
51
  isEntityReference(): boolean;
48
52
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@firecms/core",
3
3
  "type": "module",
4
- "version": "3.0.0-canary.272",
4
+ "version": "3.0.0-canary.274",
5
5
  "description": "Awesome Firebase/Firestore-based headless open-source CMS",
6
6
  "funding": {
7
7
  "url": "https://github.com/sponsors/firecmsco"
@@ -53,9 +53,9 @@
53
53
  "@dnd-kit/core": "^6.3.1",
54
54
  "@dnd-kit/modifiers": "^9.0.0",
55
55
  "@dnd-kit/sortable": "^10.0.0",
56
- "@firecms/editor": "^3.0.0-canary.272",
57
- "@firecms/formex": "^3.0.0-canary.272",
58
- "@firecms/ui": "^3.0.0-canary.272",
56
+ "@firecms/editor": "^3.0.0-canary.274",
57
+ "@firecms/formex": "^3.0.0-canary.274",
58
+ "@firecms/ui": "^3.0.0-canary.274",
59
59
  "@radix-ui/react-portal": "^1.1.9",
60
60
  "clsx": "^2.1.1",
61
61
  "date-fns": "^3.6.0",
@@ -108,7 +108,7 @@
108
108
  "dist",
109
109
  "src"
110
110
  ],
111
- "gitHead": "1b3738e54c7c7e6be9329c43091231486fe5dd74",
111
+ "gitHead": "d7256590ff4336af9a2a2a4d738ec04811d7222f",
112
112
  "publishConfig": {
113
113
  "access": "public"
114
114
  },
@@ -560,7 +560,6 @@ export function DefaultHomePage({
560
560
  onClose={() => setDialogOpenForGroup(null)}
561
561
  onRename={(newName) => {
562
562
  handleRenameGroup(dialogOpenForGroup, newName);
563
- setDialogOpenForGroup(null);
564
563
  }}
565
564
  />
566
565
  )}
@@ -504,6 +504,7 @@ export function useHomePageDnd({
504
504
  onPersist?.(updated); // <- ensure rename is saved
505
505
  return updated;
506
506
  });
507
+ setDialogOpenForGroup(null);
507
508
  };
508
509
 
509
510
  /* ---------------- public API ---------------- */
@@ -1,4 +1,4 @@
1
- import React, { useState, useEffect, useRef } from "react";
1
+ import React, { useEffect, useRef, useState } from "react";
2
2
  import { Button, Dialog, DialogActions, DialogContent, DialogTitle, TextField } from "@firecms/ui";
3
3
 
4
4
  interface RenameGroupDialogProps {
@@ -9,7 +9,13 @@ interface RenameGroupDialogProps {
9
9
  onRename: (newName: string) => void;
10
10
  }
11
11
 
12
- export function RenameGroupDialog({ open, initialName, existingGroupNames, onClose, onRename }: RenameGroupDialogProps) {
12
+ export function RenameGroupDialog({
13
+ open,
14
+ initialName,
15
+ existingGroupNames,
16
+ onClose,
17
+ onRename
18
+ }: RenameGroupDialogProps) {
13
19
  const [name, setName] = useState(initialName);
14
20
  const [error, setError] = useState<string | null>(null);
15
21
  const inputRef = useRef<HTMLInputElement | HTMLTextAreaElement | null>(null); // Create a ref for the input
@@ -86,7 +92,7 @@ export function RenameGroupDialog({ open, initialName, existingGroupNames, onClo
86
92
  if (!open) return null;
87
93
 
88
94
  return (
89
- <Dialog open={open} onOpenChange={onClose}>
95
+ <Dialog open={open}>
90
96
  <DialogTitle>Rename Group</DialogTitle>
91
97
  <DialogContent>
92
98
  <TextField
@@ -6,12 +6,17 @@ import { useCallback, useEffect, useState } from "react";
6
6
  * when groups are removed from the navigation.
7
7
  */
8
8
  export function useCollapsedGroups(groupNames: string[]) {
9
+
10
+ console.log("Group names:", groupNames);
11
+
9
12
  // Load collapsed groups from localStorage on mount
10
13
  const [collapsedGroups, setCollapsedGroups] = useState<Record<string, boolean>>(() => {
11
14
  try {
12
15
  const stored = localStorage.getItem('firecms-collapsed-groups');
16
+ console.log("Loaded collapsed groups from localStorage:", stored);
13
17
  return stored ? JSON.parse(stored) : {};
14
18
  } catch {
19
+ console.warn("Could not access localStorage to get collapsed groups");
15
20
  return {};
16
21
  }
17
22
  });
@@ -20,13 +25,16 @@ export function useCollapsedGroups(groupNames: string[]) {
20
25
  useEffect(() => {
21
26
  try {
22
27
  localStorage.setItem('firecms-collapsed-groups', JSON.stringify(collapsedGroups));
28
+ console.log("Loaded collapsed groups from localStorage to get collapsed groups");
23
29
  } catch {
30
+ console.warn("Could not access localStorage to get collapsed groups");
24
31
  // Silently fail if localStorage is not available
25
32
  }
26
33
  }, [collapsedGroups]);
27
34
 
28
35
  // Clean up collapsed groups state when groups change - remove entries for groups that no longer exist
29
36
  useEffect(() => {
37
+ console.log("Cleaning up collapsed groups. Current groups:", groupNames, "Current collapsed state:", collapsedGroups);
30
38
  // Only clean up if we have actual groups loaded (avoid cleaning up during initial load)
31
39
  if (groupNames.length === 0) return;
32
40
 
@@ -50,10 +58,12 @@ export function useCollapsedGroups(groupNames: string[]) {
50
58
  }, [groupNames]);
51
59
 
52
60
  const isGroupCollapsed = useCallback((name: string) => {
61
+ console.log("Checking if group is collapsed:", name, "State:", collapsedGroups);
53
62
  return !!collapsedGroups[name];
54
63
  }, [collapsedGroups]);
55
64
 
56
65
  const toggleGroupCollapsed = useCallback((name: string) => {
66
+ console.log("Toggle group collapsed group:", name);
57
67
  setCollapsedGroups(prev => ({ ...prev, [name]: !prev[name] }));
58
68
  }, []);
59
69
 
@@ -50,9 +50,15 @@ export class EntityReference {
50
50
  */
51
51
  readonly path: string;
52
52
 
53
- constructor(id: string, path: string) {
53
+ /**
54
+ * Optional database ID where the entity is stored (if multiple databases are used)
55
+ */
56
+ readonly databaseId?: string;
57
+
58
+ constructor(id: string, path: string, databaseId?: string) {
54
59
  this.id = id;
55
60
  this.path = path;
61
+ this.databaseId = databaseId;
56
62
  }
57
63
 
58
64
  get pathWithId() {