eddev 0.1.40-beta-1 → 0.1.40-beta-2

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.
@@ -87,16 +87,6 @@ function BrowserRouter(props) {
87
87
  if (!pending.popped) {
88
88
  history.replaceState({ scrollPosition: (_b = document.scrollingElement) === null || _b === void 0 ? void 0 : _b.scrollTop }, "", document.location.href);
89
89
  history.pushState({}, "", pending.url);
90
- // if (document.scrollingElement) {
91
- // console.log("Scroll to top")
92
- // document.scrollingElement.scrollTop = 0
93
- // }
94
- }
95
- else {
96
- // if (document.scrollingElement) {
97
- // console.log("Scroll to", pending.scrollPosition)
98
- // document.scrollingElement.scrollTop = pending.scrollPosition || 0
99
- // }
100
90
  }
101
91
  };
102
92
  if (view && view.preload) {
@@ -112,11 +102,10 @@ function BrowserRouter(props) {
112
102
  cancelled = true;
113
103
  };
114
104
  }, [pending]);
115
- console.log("Passing", url, data);
116
- var _c = (0, react_1.useState)(null), scrollPosition = _c[0], setScrollPosition = _c[1];
105
+ var _c = (0, react_1.useState)({ value: null }), scrollPosition = _c[0], setScrollPosition = _c[1];
117
106
  (0, react_1.useEffect)(function () {
118
- if (document.scrollingElement && typeof scrollPosition === "number") {
119
- document.scrollingElement.scrollTop = scrollPosition;
107
+ if (document.scrollingElement && typeof scrollPosition.value === "number") {
108
+ document.scrollingElement.scrollTop = scrollPosition.value;
120
109
  }
121
110
  }, [scrollPosition]);
122
111
  return ((0, jsx_runtime_1.jsx)(routing_1.RouterRoot, __assign({ url: url, data: data, onNavigateRequest: function (url) {
@@ -127,10 +116,10 @@ function BrowserRouter(props) {
127
116
  }
128
117
  }, onNavigated: function () {
129
118
  if (pending && typeof pending.scrollPosition === "number") {
130
- setScrollPosition(pending.scrollPosition);
119
+ setScrollPosition({ value: pending.scrollPosition });
131
120
  }
132
121
  else {
133
- setScrollPosition(0);
122
+ setScrollPosition({ value: 0 });
134
123
  }
135
124
  } }, { children: props.children }), void 0));
136
125
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eddev",
3
- "version": "0.1.40-beta-1",
3
+ "version": "0.1.40-beta-2",
4
4
  "main": "./index.js",
5
5
  "license": "MIT",
6
6
  "bin": {
@@ -213,15 +213,7 @@ function useForkedRouter(conf, opts) {
213
213
  var ctx = (0, react_1.useMemo)(function () {
214
214
  return parent.fork(conf, opts);
215
215
  }, [parent]);
216
- // useEffect(() => {
217
- // if (onChange) {
218
- // return ctx.subscribe(onChange);
219
- // }
220
- // }, [ctx, onChange]);
221
216
  Object.assign(ctx.config, conf);
222
- // ctx.config.match = conf.match;
223
- // ctx.config.beforeLeave = conf.beforeLeave;
224
- // ctx.config.beforeLeave = conf.beforeLeave;
225
217
  (0, react_1.useEffect)(function () {
226
218
  return function () { return ctx.dispose(); };
227
219
  }, [ctx]);