masua 0.10.1 → 0.10.2

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.
Files changed (3) hide show
  1. package/index.ts +1 -0
  2. package/package.json +2 -2
  3. package/react.tsx +8 -1
package/index.ts CHANGED
@@ -263,5 +263,6 @@ export function grid(element: HTMLElement | string, configuration: Partial<Confi
263
263
 
264
264
  return {
265
265
  destroy: () => destroy(state),
266
+ update: () => layout(state),
266
267
  }
267
268
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "masua",
3
3
  "description": "Simple masonry layout library in TypeScript.",
4
- "version": "0.10.1",
4
+ "version": "0.10.2",
5
5
  "repository": "github:tobua/masua",
6
6
  "homepage": "https://tobua.github.io/masua",
7
7
  "license": "MIT",
@@ -22,7 +22,7 @@
22
22
  }
23
23
  },
24
24
  "devDependencies": {
25
- "@types/react": "^18.2.64",
25
+ "@types/react": "^18.2.65",
26
26
  "padua": "^4.0.0"
27
27
  },
28
28
  "peerDependencies": {
package/react.tsx CHANGED
@@ -17,6 +17,8 @@ const configurationProperties = [
17
17
  'wedge',
18
18
  ]
19
19
 
20
+ let instance: any
21
+
20
22
  export function Grid({
21
23
  disabled = false,
22
24
  children,
@@ -37,7 +39,12 @@ export function Grid({
37
39
 
38
40
  useEffect(() => {
39
41
  if (disabled) return () => {}
40
- return grid(gridRef.current, configurationProps).destroy
42
+ if (instance) {
43
+ instance.update()
44
+ return instance.destroy
45
+ }
46
+ instance = grid(gridRef.current, configurationProps)
47
+ return instance.destroy
41
48
  }, [children])
42
49
 
43
50
  return (