@civicactions/cmsds-open-data-components 3.1.5 → 3.1.7-alpha.1

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/dist/main.js CHANGED
@@ -1341,10 +1341,10 @@ const $1d3d480a9cfaabe0$var$useDatastore = (resourceId, rootAPIUrl, options, add
1341
1341
  });
1342
1342
  (0, $hgUW1$useEffect)(()=>{
1343
1343
  if (data) {
1344
- const propertyKeys = data.schema[id] && data.schema[id].fields ? Object.keys(data.schema[id].fields) : [];
1344
+ const propertyKeys = data.schema && data.schema[id] && data.schema[id].fields ? Object.keys(data.schema[id].fields) : [];
1345
1345
  setValues(data.results), setCount(data.count);
1346
1346
  if (propertyKeys.length) setColumns(prepareColumns ? prepareColumns(propertyKeys) : propertyKeys);
1347
- setSchema(data.schema);
1347
+ if (data.schema) setSchema(data.schema);
1348
1348
  }
1349
1349
  }, [
1350
1350
  data
@@ -3281,9 +3281,11 @@ const $a0f13962e513caa1$var$Dataset = ({ id: id, rootUrl: rootUrl, additionalPar
3281
3281
  };
3282
3282
  const [selectedTab, setSelectedTab] = (0, $hgUW1$useState)(window.location.hash.substring(1) ? window.location.hash.substring(1) : getDefaultTab());
3283
3283
  (0, $hgUW1$useEffect)(()=>{
3284
- setSelectedTab(getDefaultTab());
3284
+ if (!window.location.hash.substring(1)) setSelectedTab(getDefaultTab());
3285
+ else if (window.location.hash.substring(1) != selectedTab) setSelectedTab(window.location.hash.substring(1));
3285
3286
  }, [
3286
- distribution
3287
+ distribution,
3288
+ window.location.hash
3287
3289
  ]);
3288
3290
  return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Fragment), {
3289
3291
  children: dataset.error ? /*#__PURE__*/ (0, $hgUW1$jsx)((0, $026cb986f9fea2b1$export$2e2bcd8739ae039), {