@codeleap/web 3.12.4 → 3.12.5

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": "@codeleap/web",
3
- "version": "3.12.4",
3
+ "version": "3.12.5",
4
4
  "main": "src/index.ts",
5
5
  "repository": {
6
6
  "url": "https://github.com/codeleap-uk/internal-libs-monorepo.git",
@@ -11,7 +11,6 @@ import {
11
11
  MasonryProps,
12
12
  RenderComponentProps,
13
13
  } from 'masonic'
14
- import { EmptyPlaceholder } from '../components/EmptyPlaceholder'
15
14
 
16
15
  export type ItemMasonryProps<T> = RenderComponentProps<T>
17
16
 
@@ -28,14 +27,23 @@ export function ListMasonry<Item>(props: ListMasonryProps<Item>) {
28
27
  const dataPreviousLength = usePrevious(data?.length)
29
28
 
30
29
  onUpdate(() => {
31
- if (data?.length < dataPreviousLength) {
30
+ console.log({
31
+ dataPreviousLength,
32
+ length: data?.length
33
+ })
34
+
35
+ if (dataPreviousLength > data?.length) {
32
36
  setReloadingLayout(true)
33
37
 
38
+ console.log({
39
+ reloaded: true,
40
+ })
41
+
34
42
  setTimeout(() => {
35
43
  setReloadingLayout(false)
36
44
  }, 3000)
37
45
  }
38
- }, [data?.length])
46
+ }, [data?.length, dataPreviousLength])
39
47
 
40
48
  const containerRef = React.useRef(null)
41
49
 
@@ -57,7 +65,7 @@ export function ListMasonry<Item>(props: ListMasonryProps<Item>) {
57
65
  props
58
66
  ) as any
59
67
 
60
- listProps.positioner = usePositioner({
68
+ const positioner = usePositioner({
61
69
  width: listProps?.width,
62
70
  columnGutter: listProps?.columnGutter,
63
71
  columnWidth: listProps?.columnWidth,
@@ -68,14 +76,16 @@ export function ListMasonry<Item>(props: ListMasonryProps<Item>) {
68
76
 
69
77
  const { scrollTop, isScrolling } = useScroller(listProps?.offset, listProps?.scrollFps)
70
78
 
71
- listProps.resizeObserver = useResizeObserver(listProps.positioner)
79
+ const resizeObserver = useResizeObserver(positioner)
72
80
 
73
81
  if (reloadingLayout) {
74
- return <EmptyPlaceholder loading={true} title={''} description={null} />
82
+ return <div><p>Loading</p></div>
75
83
  }
76
84
 
77
85
  return useMasonry({
78
86
  ...listProps,
87
+ resizeObserver,
88
+ positioner,
79
89
  scrollTop,
80
90
  isScrolling,
81
91
  items: data,