ywana-core8 0.0.714 → 0.0.715

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": "ywana-core8",
3
- "version": "0.0.714",
3
+ "version": "0.0.715",
4
4
  "description": "ywana-core8",
5
5
  "homepage": "https://ywana.github.io/workspace",
6
6
  "author": "Ernesto Roldan Garcia",
@@ -1,4 +1,4 @@
1
- import React, { useState } from 'react'
1
+ import React, { useEffect, useState } from 'react'
2
2
  import { CollectionAPI } from "./CollectionAPI";
3
3
 
4
4
  export const CollectionContext = React.createContext()
@@ -12,12 +12,17 @@ export const CollectionContextProvider = (props) => {
12
12
  const API = CollectionAPI(url, host)
13
13
 
14
14
  const [all, setAll] = useState([])
15
- const [filters, setFilters] = useState({})
15
+ const [filters, setFilters] = useState()
16
16
  const [likes, setLikes] = useState([])
17
17
  const [customFilters, setCustomFilters] = useState({})
18
18
  const [queries, setQueries] = useState([])
19
19
  const [selected, setSelected] = useState(null)
20
20
 
21
+ useEffect(() => {
22
+ console.log("CONTEXT LOAD", filters, customFilters)
23
+ load()
24
+ }, [filters, customFilters])
25
+
21
26
  async function load() {
22
27
 
23
28
  const runCustomFilters = (all) => {
@@ -54,13 +54,17 @@ export const CollectionFilters = (props) => {
54
54
  )
55
55
  }
56
56
 
57
+ /**
58
+ * Collection Filters Resume
59
+ */
57
60
  const CollectionFiltersResume = (props) => {
58
61
 
59
62
  const { schema } = props
60
63
  const context = useContext(CollectionContext)
61
64
  const { filters } = context
62
- const fields = Object.keys(filters)
63
65
 
66
+ if (!filters) return null
67
+ const fields = Object.keys(filters)
64
68
  if (!fields.length) return null
65
69
 
66
70
  return (
@@ -13,9 +13,7 @@ export const CollectionList = (props) => {
13
13
  const { all = [], selected, filters, customFilters } = context
14
14
  const [search, setSearch] = useState('')
15
15
 
16
- useEffect(() => {
17
- context.load()
18
- }, [filters, customFilters])
16
+
19
17
 
20
18
  function changeSearch(id, value) {
21
19
  setSearch(value)
@@ -34,7 +34,7 @@ const CollectionPageTest = (prop) => {
34
34
  title: <CustomTitle />,
35
35
  canFilter: true,
36
36
  customFilters: [<CustomFilter1 />, <CustomFilter2 />],
37
- filtersValue: { name: "111111"},
37
+ filtersValue: { name: "333"},
38
38
  listSearchBy: ["name"],
39
39
  listGroupBy: "name",
40
40
  listItemRenderer,