kitzo 2.1.15 → 2.1.16

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/README.md CHANGED
@@ -26,7 +26,7 @@ npm i kitzo
26
26
  or
27
27
 
28
28
  ```javascript
29
- <script src="https://cdn.jsdelivr.net/npm/kitzo@2.1.15/dist/kitzo.umd.min.js"></script>
29
+ <script src="https://cdn.jsdelivr.net/npm/kitzo@2.1.16/dist/kitzo.umd.min.js"></script>
30
30
  ```
31
31
 
32
32
  > Vanilla: Attach this script tag in the html head tag and you are good to go.
package/dist/react.esm.js CHANGED
@@ -713,19 +713,7 @@ function useScrollRestoration(path, key, options = {}) {
713
713
  const mapKey = `${pathname}::${key}`;
714
714
  const saved = history.current.get(mapKey);
715
715
  const restore = () => {
716
- if (!saved) {
717
- window.scrollTo({
718
- top: 0,
719
- left: 0,
720
- behavior: 'auto'
721
- });
722
- element.scrollTo({
723
- top: 0,
724
- left: 0,
725
- behavior: 'auto'
726
- });
727
- return;
728
- }
716
+ if (!saved) return;
729
717
  if (isWindow) {
730
718
  window.scrollTo({
731
719
  top: saved.top,
@@ -747,6 +735,20 @@ function useScrollRestoration(path, key, options = {}) {
747
735
  } else {
748
736
  restore();
749
737
  }
738
+ } else {
739
+ if (isWindow) {
740
+ window.scrollTo({
741
+ top: 0,
742
+ left: 0,
743
+ behavior: 'auto'
744
+ });
745
+ } else if (element) {
746
+ element.scrollTo({
747
+ top: 0,
748
+ left: 0,
749
+ behavior: 'auto'
750
+ });
751
+ }
750
752
  }
751
753
  let timeoutId = null;
752
754
  const save = () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kitzo",
3
- "version": "2.1.15",
3
+ "version": "2.1.16",
4
4
  "description": "A lightweight JavaScript UI micro-library.",
5
5
  "type": "module",
6
6
  "main": "./dist/kitzo.umd.js",