@pagamio/frontend-commons-lib 0.8.274 → 0.8.275

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.
@@ -12,9 +12,18 @@ const MultiFormEngineDrawerProviderContext = createContext(undefined);
12
12
  export const MultiFormEngineDrawerProvider = ({ pathname, children }) => {
13
13
  const [drawerStates, setDrawerStates] = useState(new Map());
14
14
  const formDataRef = useRef(new Map());
15
+ const prevPathnameRef = useRef(pathname);
15
16
  useEffect(() => {
16
17
  setupInputRegistry();
17
18
  }, []);
19
+ // Clear drawers synchronously during render when pathname changes
20
+ // (useEffect fires too late, causing the new page to render with compressed layout)
21
+ if (prevPathnameRef.current !== pathname) {
22
+ prevPathnameRef.current = pathname;
23
+ if (drawerStates.size > 0) {
24
+ setDrawerStates(new Map());
25
+ }
26
+ }
18
27
  const handleOpenDrawer = useCallback((key) => {
19
28
  setDrawerStates((prev) => new Map(prev).set(key, true));
20
29
  }, []);
@@ -51,9 +60,6 @@ export const MultiFormEngineDrawerProvider = ({ pathname, children }) => {
51
60
  const hasFormData = useCallback((key) => {
52
61
  return formDataRef.current.has(key);
53
62
  }, []);
54
- useEffect(() => {
55
- setDrawerStates(new Map());
56
- }, [pathname]);
57
63
  const contextValue = useMemo(() => ({
58
64
  isOpen,
59
65
  isAnyDrawerOpen,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pagamio/frontend-commons-lib",
3
3
  "description": "Pagamio library for Frontend reusable components like the form engine and table container",
4
- "version": "0.8.274",
4
+ "version": "0.8.275",
5
5
  "publishConfig": {
6
6
  "access": "public",
7
7
  "provenance": false