Skip to content

Commit

Permalink
Switch fetch conditional for columns to schema (#26)
Browse files Browse the repository at this point in the history
* Switch fetch conditional for columns to schema

* Bump to 1.2.0
  • Loading branch information
dgading authored Dec 16, 2021
1 parent aef035f commit 248e904
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@civicactions/data-catalog-services",
"version": "1.1.0",
"version": "1.2.0",
"description": "Functions and React components to connect to the DKAN api.",
"main": "lib/index.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useDatastore/fetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export async function fetchDataFromQuery(id, rootUrl, options, additionalParams)
const propertyKeys = data.schema[id] && data.schema[id].fields ? Object.keys(data.schema[id].fields) : [];
setValues(data.results),
setCount(data.count)
if(data.results.length) {
if(propertyKeys.length) {
setColumns(prepareColumns ? prepareColumns(propertyKeys) : propertyKeys)
}
setSchema(data.schema)
Expand Down

0 comments on commit 248e904

Please sign in to comment.