@thoughtbot/superglue 0.53.3 → 0.53.4

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.
@@ -11,27 +11,20 @@ exports.copyPage = copyPage;
11
11
  exports.handleGraft = handleGraft;
12
12
  exports.saveAndProcessPage = saveAndProcessPage;
13
13
  exports.saveResponse = saveResponse;
14
-
15
14
  var _utils = require("../utils");
16
-
17
15
  var _urlParse = _interopRequireDefault(require("url-parse"));
18
-
19
16
  var _actions = require("../actions");
20
-
21
17
  var _requests = require("./requests");
22
-
23
18
  Object.keys(_requests).forEach(function (key) {
24
19
  if (key === "default" || key === "__esModule") return;
25
20
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
26
21
  if (key in exports && exports[key] === _requests[key]) return;
27
22
  exports[key] = _requests[key];
28
23
  });
29
-
30
24
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
31
-
32
25
  function copyPage(_ref) {
33
26
  var from = _ref.from,
34
- to = _ref.to;
27
+ to = _ref.to;
35
28
  return {
36
29
  type: _actions.COPY_PAGE,
37
30
  payload: {
@@ -40,10 +33,9 @@ function copyPage(_ref) {
40
33
  }
41
34
  };
42
35
  }
43
-
44
36
  function saveResponse(_ref2) {
45
37
  var pageKey = _ref2.pageKey,
46
- page = _ref2.page;
38
+ page = _ref2.page;
47
39
  pageKey = (0, _utils.urlToPageKey)(pageKey);
48
40
  return {
49
41
  type: _actions.SAVE_RESPONSE,
@@ -53,10 +45,9 @@ function saveResponse(_ref2) {
53
45
  }
54
46
  };
55
47
  }
56
-
57
48
  function handleGraft(_ref3) {
58
49
  var pageKey = _ref3.pageKey,
59
- page = _ref3.page;
50
+ page = _ref3.page;
60
51
  pageKey = (0, _utils.urlToPageKey)(pageKey);
61
52
  return {
62
53
  type: _actions.HANDLE_GRAFT,
@@ -66,12 +57,10 @@ function handleGraft(_ref3) {
66
57
  }
67
58
  };
68
59
  }
69
-
70
60
  function fetchDeferments(pageKey, defers) {
71
61
  if (defers === void 0) {
72
62
  defers = [];
73
63
  }
74
-
75
64
  pageKey = (0, _utils.urlToPageKey)(pageKey);
76
65
  return function (dispatch) {
77
66
  var fetches = defers.filter(function (_ref4) {
@@ -79,10 +68,10 @@ function fetchDeferments(pageKey, defers) {
79
68
  return type === 'auto';
80
69
  }).map(function (_ref5) {
81
70
  var url = _ref5.url,
82
- _ref5$successAction = _ref5.successAction,
83
- successAction = _ref5$successAction === void 0 ? _actions.GRAFTING_SUCCESS : _ref5$successAction,
84
- _ref5$failAction = _ref5.failAction,
85
- failAction = _ref5$failAction === void 0 ? _actions.GRAFTING_ERROR : _ref5$failAction;
71
+ _ref5$successAction = _ref5.successAction,
72
+ successAction = _ref5$successAction === void 0 ? _actions.GRAFTING_SUCCESS : _ref5$successAction,
73
+ _ref5$failAction = _ref5.failAction,
74
+ failAction = _ref5$failAction === void 0 ? _actions.GRAFTING_ERROR : _ref5$failAction;
86
75
  var parsedUrl = new _urlParse["default"](url, true);
87
76
  var keyPath = parsedUrl.query.props_at;
88
77
  return dispatch((0, _requests.remote)(url, {
@@ -110,12 +99,11 @@ function fetchDeferments(pageKey, defers) {
110
99
  return Promise.all(fetches);
111
100
  };
112
101
  }
113
-
114
102
  function updateFragmentsUsing(page) {
115
103
  var changedFragments = {};
116
104
  page.fragments.forEach(function (fragment) {
117
105
  var type = fragment.type,
118
- path = fragment.path;
106
+ path = fragment.path;
119
107
  changedFragments[type] = (0, _utils.getIn)(page, path);
120
108
  });
121
109
  return {
@@ -125,13 +113,11 @@ function updateFragmentsUsing(page) {
125
113
  }
126
114
  };
127
115
  }
128
-
129
116
  function saveAndProcessPage(pageKey, page) {
130
117
  return function (dispatch, getState) {
131
118
  pageKey = (0, _utils.urlToPageKey)(pageKey);
132
119
  var _page$defers = page.defers,
133
- defers = _page$defers === void 0 ? [] : _page$defers;
134
-
120
+ defers = _page$defers === void 0 ? [] : _page$defers;
135
121
  if ((0, _utils.isGraft)(page)) {
136
122
  dispatch(handleGraft({
137
123
  pageKey: pageKey,
@@ -143,9 +129,7 @@ function saveAndProcessPage(pageKey, page) {
143
129
  page: page
144
130
  }));
145
131
  }
146
-
147
132
  var hasFetch = typeof fetch != 'undefined';
148
-
149
133
  if (hasFetch) {
150
134
  return dispatch(fetchDeferments(pageKey, defers)).then(function () {
151
135
  if (page.fragments.length > 0) {
@@ -3,34 +3,27 @@
3
3
  exports.__esModule = true;
4
4
  exports.remote = remote;
5
5
  exports.visit = visit;
6
-
7
6
  var _utils = require("../utils");
8
-
9
7
  var _actions = require("../actions");
10
-
11
8
  var _index = require("./index");
12
-
13
9
  function beforeVisit(payload) {
14
10
  return {
15
11
  type: _actions.BEFORE_VISIT,
16
12
  payload: payload
17
13
  };
18
14
  }
19
-
20
15
  function beforeRemote(payload) {
21
16
  return {
22
17
  type: _actions.BEFORE_REMOTE,
23
18
  payload: payload
24
19
  };
25
20
  }
26
-
27
21
  function beforeFetch(payload) {
28
22
  return {
29
23
  type: _actions.BEFORE_FETCH,
30
24
  payload: payload
31
25
  };
32
26
  }
33
-
34
27
  function handleError(err) {
35
28
  return {
36
29
  type: _actions.SUPERGLUE_ERROR,
@@ -39,7 +32,6 @@ function handleError(err) {
39
32
  }
40
33
  };
41
34
  }
42
-
43
35
  function handleFetchErr(err, fetchArgs, dispatch) {
44
36
  err.fetchArgs = fetchArgs;
45
37
  err.url = fetchArgs[0];
@@ -47,7 +39,6 @@ function handleFetchErr(err, fetchArgs, dispatch) {
47
39
  dispatch(handleError(err));
48
40
  throw err;
49
41
  }
50
-
51
42
  function buildMeta(pageKey, page, state) {
52
43
  var prevAssets = state.assets;
53
44
  var nextAssets = page.assets;
@@ -58,20 +49,18 @@ function buildMeta(pageKey, page, state) {
58
49
  needsRefresh: (0, _utils.needsRefresh)(prevAssets, nextAssets)
59
50
  };
60
51
  }
61
-
62
52
  function remote(path, _temp) {
63
53
  var _ref = _temp === void 0 ? {} : _temp,
64
- _ref$method = _ref.method,
65
- method = _ref$method === void 0 ? 'GET' : _ref$method,
66
- headers = _ref.headers,
67
- _ref$body = _ref.body,
68
- body = _ref$body === void 0 ? '' : _ref$body,
69
- pageKey = _ref.pageKey,
70
- _ref$beforeSave = _ref.beforeSave,
71
- beforeSave = _ref$beforeSave === void 0 ? function (prevPage, receivedPage) {
72
- return receivedPage;
73
- } : _ref$beforeSave;
74
-
54
+ _ref$method = _ref.method,
55
+ method = _ref$method === void 0 ? 'GET' : _ref$method,
56
+ headers = _ref.headers,
57
+ _ref$body = _ref.body,
58
+ body = _ref$body === void 0 ? '' : _ref$body,
59
+ pageKey = _ref.pageKey,
60
+ _ref$beforeSave = _ref.beforeSave,
61
+ beforeSave = _ref$beforeSave === void 0 ? function (prevPage, receivedPage) {
62
+ return receivedPage;
63
+ } : _ref$beforeSave;
75
64
  path = (0, _utils.withoutBusters)(path);
76
65
  pageKey = pageKey && (0, _utils.urlToPageKey)(pageKey);
77
66
  return function (dispatch, getState) {
@@ -91,15 +80,12 @@ function remote(path, _temp) {
91
80
  }));
92
81
  return fetch.apply(void 0, fetchArgs).then(_utils.parseResponse).then(function (_ref2) {
93
82
  var _pages$currentPageKey;
94
-
95
83
  var rsp = _ref2.rsp,
96
- json = _ref2.json;
97
-
84
+ json = _ref2.json;
98
85
  var _getState = getState(),
99
- superglue = _getState.superglue,
100
- _getState$pages = _getState.pages,
101
- pages = _getState$pages === void 0 ? {} : _getState$pages;
102
-
86
+ superglue = _getState.superglue,
87
+ _getState$pages = _getState.pages,
88
+ pages = _getState$pages === void 0 ? {} : _getState$pages;
103
89
  var meta = Object.assign({}, buildMeta(pageKey, json, superglue), {
104
90
  redirected: rsp.redirected,
105
91
  rsp: rsp,
@@ -108,11 +94,9 @@ function remote(path, _temp) {
108
94
  var willReplaceCurrent = pageKey == currentPageKey;
109
95
  var existingId = (_pages$currentPageKey = pages[currentPageKey]) == null ? void 0 : _pages$currentPageKey.componentIdentifier;
110
96
  var receivedId = json.componentIdentifier;
111
-
112
97
  if (willReplaceCurrent && !!existingId && existingId != receivedId) {
113
98
  console.warn("You're about replace an existing page located at pages[\"" + currentPageKey + "\"]\nthat has the componentIdentifier \"" + existingId + "\" with the contents of a\nreceived page that has a componentIdentifier of \"" + receivedId + "\".\n\nThis can happen if you're using data-sg-remote or remote but your response\nredirected to a completely different page. Since remote requests do not\nnavigate or change the current page component, your current page component may\nreceive a shape that is unexpected and cause issues with rendering.\n\nConsider using data-sg-visit, the visit function, or redirect_back.");
114
99
  }
115
-
116
100
  var page = beforeSave(pages[pageKey], json);
117
101
  return dispatch((0, _index.saveAndProcessPage)(pageKey, page)).then(function () {
118
102
  meta.pageKey = pageKey;
@@ -123,49 +107,44 @@ function remote(path, _temp) {
123
107
  });
124
108
  };
125
109
  }
126
-
127
110
  var lastVisitController = {
128
- abort: function abort() {}
111
+ abort: function abort() {
112
+ // noop
113
+ }
129
114
  };
130
-
131
115
  function visit(path, _temp2) {
132
116
  var _ref3 = _temp2 === void 0 ? {} : _temp2,
133
- _ref3$method = _ref3.method,
134
- method = _ref3$method === void 0 ? 'GET' : _ref3$method,
135
- headers = _ref3.headers,
136
- _ref3$body = _ref3.body,
137
- body = _ref3$body === void 0 ? '' : _ref3$body,
138
- placeholderKey = _ref3.placeholderKey,
139
- _ref3$beforeSave = _ref3.beforeSave,
140
- beforeSave = _ref3$beforeSave === void 0 ? function (prevPage, receivedPage) {
141
- return receivedPage;
142
- } : _ref3$beforeSave,
143
- _ref3$revisit = _ref3.revisit,
144
- revisit = _ref3$revisit === void 0 ? false : _ref3$revisit;
145
-
117
+ _ref3$method = _ref3.method,
118
+ method = _ref3$method === void 0 ? 'GET' : _ref3$method,
119
+ headers = _ref3.headers,
120
+ _ref3$body = _ref3.body,
121
+ body = _ref3$body === void 0 ? '' : _ref3$body,
122
+ placeholderKey = _ref3.placeholderKey,
123
+ _ref3$beforeSave = _ref3.beforeSave,
124
+ beforeSave = _ref3$beforeSave === void 0 ? function (prevPage, receivedPage) {
125
+ return receivedPage;
126
+ } : _ref3$beforeSave,
127
+ _ref3$revisit = _ref3.revisit,
128
+ revisit = _ref3$revisit === void 0 ? false : _ref3$revisit;
146
129
  path = (0, _utils.withoutBusters)(path);
147
130
  var pageKey = (0, _utils.urlToPageKey)(path);
148
131
  return function (dispatch, getState) {
149
132
  placeholderKey = placeholderKey && (0, _utils.urlToPageKey)(placeholderKey);
150
133
  var hasPlaceholder = !!getState().pages[placeholderKey];
151
-
152
134
  if (placeholderKey && hasPlaceholder) {
153
135
  dispatch((0, _index.copyPage)({
154
136
  from: placeholderKey,
155
137
  to: pageKey
156
138
  }));
157
139
  }
158
-
159
140
  if (placeholderKey && !hasPlaceholder) {
160
141
  console.warn("Could not find placeholder with key " + placeholderKey + " in state. The props_at param will be ignored");
161
142
  path = (0, _utils.removePropsAt)(path);
162
143
  }
163
-
164
144
  if (!placeholderKey && (0, _utils.hasPropsAt)(path)) {
165
145
  console.warn("visit was called with props_at param in the path " + path + ", this will be ignore unless you provide a placeholder.");
166
146
  path = (0, _utils.removePropsAt)(path);
167
147
  }
168
-
169
148
  var controller = new AbortController();
170
149
  var signal = controller.signal;
171
150
  var fetchArgs = (0, _utils.argsForFetch)(getState, path, {
@@ -186,44 +165,36 @@ function visit(path, _temp2) {
186
165
  lastVisitController = controller;
187
166
  return fetch.apply(void 0, fetchArgs).then(_utils.parseResponse).then(function (_ref4) {
188
167
  var rsp = _ref4.rsp,
189
- json = _ref4.json;
190
-
168
+ json = _ref4.json;
191
169
  var _getState2 = getState(),
192
- superglue = _getState2.superglue,
193
- _getState2$pages = _getState2.pages,
194
- pages = _getState2$pages === void 0 ? {} : _getState2$pages;
195
-
170
+ superglue = _getState2.superglue,
171
+ _getState2$pages = _getState2.pages,
172
+ pages = _getState2$pages === void 0 ? {} : _getState2$pages;
196
173
  var meta = Object.assign({}, buildMeta(pageKey, json, superglue), {
197
174
  redirected: rsp.redirected,
198
175
  rsp: rsp,
199
176
  fetchArgs: fetchArgs
200
177
  });
178
+ var isGet = fetchArgs[1].method === 'GET';
201
179
  meta.suggestedAction = 'push';
202
-
203
- if (!rsp.redirected && fetchArgs[1].method != 'GET') {
180
+ if (!rsp.redirected && !isGet) {
204
181
  meta.suggestedAction = 'replace';
205
182
  }
206
-
207
- if (revisit && fetchArgs[1].method == 'GET') {
183
+ if (revisit && isGet) {
208
184
  if (rsp.redirected) {
209
185
  meta.suggestedAction = 'replace';
210
186
  } else {
211
187
  meta.suggestedAction = 'none';
212
188
  }
213
189
  }
214
-
215
- if (method !== 'GET') {
216
- var contentLocation = rsp.headers.get('content-location');
217
-
218
- if (contentLocation) {
219
- pageKey = (0, _utils.urlToPageKey)(contentLocation);
220
- }
190
+ pageKey = (0, _utils.urlToPageKey)(rsp.url);
191
+ if (!isGet && !rsp.redirected) {
192
+ pageKey = currentPageKey;
221
193
  }
222
-
223
- if (rsp.redirected) {
224
- pageKey = (0, _utils.urlToPageKey)(rsp.url);
194
+ var contentLocation = rsp.headers.get('content-location');
195
+ if (contentLocation) {
196
+ pageKey = (0, _utils.urlToPageKey)(contentLocation);
225
197
  }
226
-
227
198
  var page = beforeSave(pages[pageKey], json);
228
199
  return dispatch((0, _index.saveAndProcessPage)(pageKey, page)).then(function () {
229
200
  meta.pageKey = pageKey;
package/components/Nav.js CHANGED
@@ -2,33 +2,22 @@
2
2
 
3
3
  exports.__esModule = true;
4
4
  exports["default"] = void 0;
5
-
6
5
  var _react = _interopRequireDefault(require("react"));
7
-
8
6
  var _utils = require("../utils");
9
-
10
7
  var _actions = require("../actions");
11
-
12
8
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
13
-
14
9
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
15
-
16
10
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
17
-
18
11
  function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
19
-
20
12
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
21
-
22
13
  var Nav = /*#__PURE__*/function (_React$Component) {
23
14
  _inheritsLoose(Nav, _React$Component);
24
-
25
15
  function Nav(props) {
26
16
  var _this;
27
-
28
17
  _this = _React$Component.call(this, props) || this;
29
18
  var _this$props = _this.props,
30
- history = _this$props.history,
31
- initialPageKey = _this$props.initialPageKey;
19
+ history = _this$props.history,
20
+ initialPageKey = _this$props.initialPageKey;
32
21
  _this.history = history;
33
22
  _this.navigateTo = _this.navigateTo.bind(_assertThisInitialized(_this));
34
23
  _this.scrollTo = _this.scrollTo.bind(_assertThisInitialized(_this));
@@ -40,34 +29,27 @@ var Nav = /*#__PURE__*/function (_React$Component) {
40
29
  _this.hasWindow = typeof window !== 'undefined';
41
30
  return _this;
42
31
  }
43
-
44
32
  var _proto = Nav.prototype;
45
-
46
33
  _proto.componentDidMount = function componentDidMount() {
47
34
  this.unsubscribeHistory = this.history.listen(this.onHistoryChange);
48
35
  };
49
-
50
36
  _proto.componentWillUnmount = function componentWillUnmount() {
51
37
  this.unsubscribeHistory();
52
38
  };
53
-
54
39
  _proto.navigateTo = function navigateTo(path, _temp) {
55
40
  var _ref = _temp === void 0 ? {
56
- action: 'push',
57
- ownProps: {}
58
- } : _temp,
59
- action = _ref.action,
60
- ownProps = _ref.ownProps;
61
-
41
+ action: 'push',
42
+ ownProps: {}
43
+ } : _temp,
44
+ action = _ref.action,
45
+ ownProps = _ref.ownProps;
62
46
  if (action === 'none') {
63
47
  return false;
64
48
  }
65
-
66
49
  path = (0, _utils.pathWithoutBZParams)(path);
67
50
  var nextPageKey = (0, _utils.urlToPageKey)(path);
68
51
  var store = this.props.store;
69
52
  var hasPage = !!store.getState().pages[nextPageKey];
70
-
71
53
  if (hasPage) {
72
54
  var location = this.history.location;
73
55
  var prevPageKey = location.state.pageKey;
@@ -77,10 +59,8 @@ var Nav = /*#__PURE__*/function (_React$Component) {
77
59
  posY: 0,
78
60
  posX: 0
79
61
  }];
80
-
81
62
  if (action === 'push') {
82
63
  var _this$history;
83
-
84
64
  if (this.hasWindow) {
85
65
  this.history.replace({
86
66
  pathname: location.pathname,
@@ -91,22 +71,17 @@ var Nav = /*#__PURE__*/function (_React$Component) {
91
71
  posX: window.pageXOffset
92
72
  }));
93
73
  }
94
-
95
74
  (_this$history = this.history).push.apply(_this$history, historyArgs);
96
75
  }
97
-
98
76
  if (action === 'replace') {
99
77
  var _this$history2;
100
-
101
78
  (_this$history2 = this.history).replace.apply(_this$history2, historyArgs);
102
79
  }
103
-
104
80
  this.setState({
105
81
  pageKey: nextPageKey,
106
82
  ownProps: ownProps
107
83
  });
108
84
  this.scrollTo(0, 0);
109
-
110
85
  if (action === 'replace' && prevPageKey && prevPageKey !== nextPageKey) {
111
86
  store.dispatch({
112
87
  type: _actions.REMOVE_PAGE,
@@ -115,31 +90,26 @@ var Nav = /*#__PURE__*/function (_React$Component) {
115
90
  }
116
91
  });
117
92
  }
118
-
119
93
  return true;
120
94
  } else {
121
95
  console.warn("`navigateTo` was called , but could not find.\n the pageKey in the store. This may happen when the wrong\n content_location was set in your non-get controller action.\n No navigation will take place");
122
96
  return false;
123
97
  }
124
98
  };
125
-
126
99
  _proto.scrollTo = function scrollTo(posX, posY) {
127
100
  this.hasWindow && window.scrollTo(posX, posY);
128
101
  };
129
-
130
102
  _proto.onHistoryChange = function onHistoryChange(_ref2) {
131
103
  var _this2 = this;
132
-
133
104
  var location = _ref2.location,
134
- action = _ref2.action;
105
+ action = _ref2.action;
135
106
  var _this$props2 = this.props,
136
- store = _this$props2.store,
137
- visit = _this$props2.visit;
107
+ store = _this$props2.store,
108
+ visit = _this$props2.visit;
138
109
  var pathname = location.pathname,
139
- search = location.search,
140
- hash = location.hash,
141
- state = location.state;
142
-
110
+ search = location.search,
111
+ hash = location.hash,
112
+ state = location.state;
143
113
  if (state && state.superglue) {
144
114
  store.dispatch({
145
115
  type: _actions.HISTORY_CHANGE,
@@ -149,19 +119,15 @@ var Nav = /*#__PURE__*/function (_React$Component) {
149
119
  hash: hash
150
120
  }
151
121
  });
152
-
153
122
  if (action !== 'POP') {
154
123
  return;
155
124
  }
156
-
157
125
  var pageKey = state.pageKey,
158
- posX = state.posX,
159
- posY = state.posY;
126
+ posX = state.posX,
127
+ posY = state.posY;
160
128
  var containsKey = !!store.getState().pages[pageKey];
161
-
162
129
  if (containsKey) {
163
130
  var restoreStrategy = store.getState().pages[pageKey].restoreStrategy;
164
-
165
131
  switch (restoreStrategy) {
166
132
  case 'fromCacheOnly':
167
133
  this.setState({
@@ -169,7 +135,6 @@ var Nav = /*#__PURE__*/function (_React$Component) {
169
135
  });
170
136
  this.scrollTo(posX, posY);
171
137
  break;
172
-
173
138
  case 'fromCacheAndRevisitInBackground':
174
139
  this.setState({
175
140
  pageKey: pageKey
@@ -179,7 +144,6 @@ var Nav = /*#__PURE__*/function (_React$Component) {
179
144
  revisit: true
180
145
  });
181
146
  break;
182
-
183
147
  case 'revisitOnly':
184
148
  default:
185
149
  visit(pageKey, {
@@ -188,12 +152,10 @@ var Nav = /*#__PURE__*/function (_React$Component) {
188
152
  if (meta === undefined) {
189
153
  console.warn("scoll restoration was skipped. Your visit's then funtion\n should return the meta object it recieved if you want your\n application to restore the page's previous scroll.");
190
154
  }
191
-
192
155
  if (!!meta && meta.suggestedAction === 'none') {
193
156
  _this2.setState({
194
157
  pageKey: pageKey
195
158
  });
196
-
197
159
  _this2.scrollTo(posX, posY);
198
160
  }
199
161
  });
@@ -205,41 +167,34 @@ var Nav = /*#__PURE__*/function (_React$Component) {
205
167
  if (meta === undefined) {
206
168
  console.warn("scoll restoration was skipped. Your visit's then funtion\n should return the meta object it recieved if you want your\n application to restore the page's previous scroll.");
207
169
  }
208
-
209
170
  if (!!meta && meta.suggestedAction === 'none') {
210
171
  _this2.setState({
211
172
  pageKey: pageKey
212
173
  });
213
-
214
174
  _this2.scrollTo(posX, posY);
215
175
  }
216
176
  });
217
177
  }
218
178
  }
219
179
  };
220
-
221
180
  _proto.notFound = function notFound(identifier) {
222
181
  var reminder = '';
223
-
224
182
  if (!identifier) {
225
183
  reminder = 'Did you forget to add `json.componentIdentifier` in your application.json.props layout?';
226
184
  }
227
-
228
185
  var error = new Error("Superglue Nav component was looking for " + identifier + " but could not find it in your mapping. " + reminder);
229
186
  throw error;
230
187
  };
231
-
232
188
  _proto.render = function render() {
233
189
  var _this$props3 = this.props,
234
- store = _this$props3.store,
235
- visit = _this$props3.visit,
236
- remote = _this$props3.remote;
190
+ store = _this$props3.store,
191
+ visit = _this$props3.visit,
192
+ remote = _this$props3.remote;
237
193
  var _this$state = this.state,
238
- pageKey = _this$state.pageKey,
239
- ownProps = _this$state.ownProps;
194
+ pageKey = _this$state.pageKey,
195
+ ownProps = _this$state.ownProps;
240
196
  var componentIdentifier = store.getState().pages[pageKey].componentIdentifier;
241
197
  var Component = this.props.mapping[componentIdentifier];
242
-
243
198
  if (Component) {
244
199
  return /*#__PURE__*/_react["default"].createElement(Component, _extends({
245
200
  pageKey: pageKey,
@@ -251,8 +206,6 @@ var Nav = /*#__PURE__*/function (_React$Component) {
251
206
  this.notFound(componentIdentifier);
252
207
  }
253
208
  };
254
-
255
209
  return Nav;
256
210
  }(_react["default"].Component);
257
-
258
211
  var _default = exports["default"] = Nav;