@cocreate/state 1.20.0 → 1.20.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/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [1.20.1](https://github.com/CoCreate-app/CoCreate-state/compare/v1.20.0...v1.20.1) (2024-02-20)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * state handling ([81461a7](https://github.com/CoCreate-app/CoCreate-state/commit/81461a74691b99e27d3eac47851fa31f3a1b49ba))
7
+
1
8
  # [1.20.0](https://github.com/CoCreate-app/CoCreate-state/compare/v1.19.0...v1.20.0) (2023-11-25)
2
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/state",
3
- "version": "1.20.0",
3
+ "version": "1.20.1",
4
4
  "description": "Data attributes which can be used for components in CoCreate framework combined as a group of attributes that dynamically change attributes & fetch custom data.",
5
5
  "keywords": [
6
6
  "state",
package/src/index.js CHANGED
@@ -103,14 +103,12 @@ async function stateAttributes(element) {
103
103
  Object.assign(statedAttributes, { [`${state_to}`]: attrValues });
104
104
  _getStateId(attrValues, state_to);
105
105
  }
106
-
106
+ statedAttributes = JSON.stringify(statedAttributes)
107
107
  if (!element.closest('href')) {
108
- let currentState = localStorage.getItem('statedAttributes');
109
- if (currentState)
110
- history.pushState({ statedAttributes: currentState, title: '', url: '' }, '', location.href);
108
+ history.pushState({ statedAttributes, title: '', url: '' }, '', location.href);
111
109
  }
112
110
 
113
- localStorage.setItem('statedAttributes', JSON.stringify(statedAttributes));
111
+ localStorage.setItem('statedAttributes', statedAttributes);
114
112
 
115
113
  document.dispatchEvent(new CustomEvent('stateEnd', {
116
114
  detail: {}