@thoughtbot/superglue 2.0.0-alpha.1 → 2.0.0-alpha.3
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/action_creators.d.mts +1 -1
- package/dist/action_creators.mjs +1 -1
- package/dist/{chunk-YS477OKK.mjs → chunk-EU2SLL5L.mjs} +246 -2
- package/dist/chunk-EU2SLL5L.mjs.map +1 -0
- package/dist/cjs/action_creators.cjs +236 -1
- package/dist/cjs/action_creators.cjs.map +1 -1
- package/dist/cjs/superglue.cjs +130 -108
- package/dist/cjs/superglue.cjs.map +1 -1
- package/dist/{index-MyfFLe4E.d.mts → index-O_srQ3Nm.d.mts} +2 -1
- package/dist/superglue.d.mts +10 -3
- package/dist/superglue.mjs +12 -228
- package/dist/superglue.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-YS477OKK.mjs.map +0 -1
- package/thoughtbot-superglue-2.0.0-alpha.1.tgz +0 -0
|
@@ -145,6 +145,7 @@ type StreamResponse = {
|
|
|
145
145
|
csrfToken?: string;
|
|
146
146
|
action: 'handleStreamResponse';
|
|
147
147
|
renderedAt: number;
|
|
148
|
+
slices: JSONObject;
|
|
148
149
|
};
|
|
149
150
|
type PageResponse = GraftResponse | SaveResponse | StreamResponse;
|
|
150
151
|
type FragmentRef = {
|
|
@@ -268,4 +269,4 @@ declare const visit: VisitCreator;
|
|
|
268
269
|
|
|
269
270
|
declare function saveAndProcessPage(pageKey: string, page: PageResponse): SaveAndProcessPageThunk;
|
|
270
271
|
|
|
271
|
-
export { type Visit as $, type ApplicationRemote as A, type VisitCreator as B, type ComponentIdentifier as C, type Defer as D, type RemoteCreator as E, type FetchArgs as F, type GraftResponse as G, type Handlers as H, type Dispatch as I, type JSONMappable as J, type Keypath as K, type UJSHandlers as L, type Meta as M, type NavigationContextProps as N, type HistoryState as O, type PageKey as P, type SaveAndProcessPageThunk as Q, type RestoreStrategy as R, type SuperglueStore as S, type MetaThunk as T, type Unproxied as U, type VisitMeta as V, type VisitMetaThunk as W, type DefermentThunk as X, type BasicRequestInit as Y, type BuildStore as Z, type BuildVisitAndRemote as _, type JSONValue as a, type VisitProps as a0, type Remote as a1, type RemoteProps as a2, type BeforeSave as a3, type GraftingSuccessAction as a4, type GraftingErrorAction as a5, MismatchedComponentError as a6, remote as a7, visit as a8, type NavigationProviderProps as b, type NavigateTo as c, type SaveResponse as d, type
|
|
272
|
+
export { type Visit as $, type ApplicationRemote as A, type VisitCreator as B, type ComponentIdentifier as C, type Defer as D, type RemoteCreator as E, type FetchArgs as F, type GraftResponse as G, type Handlers as H, type Dispatch as I, type JSONMappable as J, type Keypath as K, type UJSHandlers as L, type Meta as M, type NavigationContextProps as N, type HistoryState as O, type PageKey as P, type SaveAndProcessPageThunk as Q, type RestoreStrategy as R, type SuperglueStore as S, type MetaThunk as T, type Unproxied as U, type VisitMeta as V, type VisitMetaThunk as W, type DefermentThunk as X, type BasicRequestInit as Y, type BuildStore as Z, type BuildVisitAndRemote as _, type JSONValue as a, type VisitProps as a0, type Remote as a1, type RemoteProps as a2, type BeforeSave as a3, type GraftingSuccessAction as a4, type GraftingErrorAction as a5, MismatchedComponentError as a6, remote as a7, visit as a8, type NavigationProviderProps as b, type NavigateTo as c, type SaveResponse as d, type PageResponse as e, type SuperglueState as f, type SetupProps as g, type ApplicationVisit as h, type ApplicationProps as i, superglueReducer as j, type NavigationAction as k, type JSONPrimitive as l, type JSONObject as m, type JSONKeyable as n, type Fragment as o, pageReducer as p, type ParsedResponse as q, rootReducer as r, saveAndProcessPage as s, type Page as t, type StreamMutateMessage as u, type StreamResponse as v, type FragmentRef as w, type AllPages as x, type AllFragments as y, type RootState as z };
|
package/dist/superglue.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as history from 'history';
|
|
2
|
-
import { J as JSONMappable, K as Keypath, a as JSONValue, P as PageKey, A as ApplicationRemote, S as SuperglueStore, N as NavigationContextProps, b as NavigationProviderProps, c as NavigateTo, d as SaveResponse, F as FetchArgs, U as Unproxied,
|
|
3
|
-
export { y as AllFragments, x as AllPages, Y as BasicRequestInit, a3 as BeforeSave, Z as BuildStore, _ as BuildVisitAndRemote, C as ComponentIdentifier, D as Defer, X as DefermentThunk, I as Dispatch,
|
|
2
|
+
import { J as JSONMappable, K as Keypath, a as JSONValue, P as PageKey, A as ApplicationRemote, S as SuperglueStore, N as NavigationContextProps, b as NavigationProviderProps, c as NavigateTo, d as SaveResponse, F as FetchArgs, e as PageResponse, U as Unproxied, f as SuperglueState, g as SetupProps, h as ApplicationVisit, H as Handlers, i as ApplicationProps } from './index-O_srQ3Nm.mjs';
|
|
3
|
+
export { y as AllFragments, x as AllPages, Y as BasicRequestInit, a3 as BeforeSave, Z as BuildStore, _ as BuildVisitAndRemote, C as ComponentIdentifier, D as Defer, X as DefermentThunk, I as Dispatch, o as Fragment, w as FragmentRef, G as GraftResponse, a5 as GraftingErrorAction, a4 as GraftingSuccessAction, O as HistoryState, n as JSONKeyable, m as JSONObject, l as JSONPrimitive, M as Meta, T as MetaThunk, k as NavigationAction, t as Page, q as ParsedResponse, a1 as Remote, E as RemoteCreator, a2 as RemoteProps, R as RestoreStrategy, z as RootState, Q as SaveAndProcessPageThunk, u as StreamMutateMessage, v as StreamResponse, L as UJSHandlers, $ as Visit, B as VisitCreator, V as VisitMeta, W as VisitMetaThunk, a0 as VisitProps, p as pageReducer, r as rootReducer, s as saveAndProcessPage, j as superglueReducer } from './index-O_srQ3Nm.mjs';
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { Subscription, Consumer, ChannelNameWithParams } from '@rails/actioncable';
|
|
6
6
|
import { DebouncedFunc } from 'lodash';
|
|
@@ -66,6 +66,13 @@ declare const beforeRemote: _reduxjs_toolkit.ActionCreatorWithPayload<{
|
|
|
66
66
|
currentPageKey: PageKey;
|
|
67
67
|
fetchArgs: FetchArgs;
|
|
68
68
|
}, string>;
|
|
69
|
+
declare const receiveResponse: _reduxjs_toolkit.ActionCreatorWithPreparedPayload<[{
|
|
70
|
+
pageKey: string;
|
|
71
|
+
response: PageResponse;
|
|
72
|
+
}], {
|
|
73
|
+
pageKey: string;
|
|
74
|
+
response: PageResponse;
|
|
75
|
+
}, "@@superglue/RECEIVE_RESPONSE", never, never>;
|
|
69
76
|
|
|
70
77
|
type ProxiedContent<T> = T & {
|
|
71
78
|
readonly [K in keyof T]: T[K] extends {
|
|
@@ -102,4 +109,4 @@ declare const setup: ({ initialPage, baseUrl, path, store, buildVisitAndRemote,
|
|
|
102
109
|
};
|
|
103
110
|
declare function Application({ initialPage, baseUrl, path, store, buildVisitAndRemote, history, mapping, ...rest }: ApplicationProps): React.JSX.Element;
|
|
104
111
|
|
|
105
|
-
export { Application, ApplicationProps, ApplicationRemote, ApplicationVisit, FetchArgs, GRAFTING_ERROR, GRAFTING_SUCCESS, Handlers, JSONMappable, JSONValue, Keypath, NavigateTo, NavigationContext, NavigationContextProps, NavigationProvider, NavigationProviderProps, PageKey, SaveResponse, SetupProps, SuperglueState, SuperglueStore, Unproxied, beforeFetch, beforeRemote, beforeVisit, copyPage, getIn, prepareStore, removePage, saveResponse, setup, unproxy, urlToPageKey, useContent, useSetFragment, useStreamSource, useSuperglue };
|
|
112
|
+
export { Application, ApplicationProps, ApplicationRemote, ApplicationVisit, FetchArgs, GRAFTING_ERROR, GRAFTING_SUCCESS, Handlers, JSONMappable, JSONValue, Keypath, NavigateTo, NavigationContext, NavigationContextProps, NavigationProvider, NavigationProviderProps, PageKey, PageResponse, SaveResponse, SetupProps, SuperglueState, SuperglueStore, Unproxied, beforeFetch, beforeRemote, beforeVisit, copyPage, getIn, prepareStore, receiveResponse, removePage, saveResponse, setup, unproxy, urlToPageKey, useContent, useSetFragment, useStreamSource, useSuperglue };
|
package/dist/superglue.mjs
CHANGED
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
beforeVisit,
|
|
11
11
|
config,
|
|
12
12
|
copyPage,
|
|
13
|
+
createProxy,
|
|
13
14
|
getIn,
|
|
14
15
|
handleFragmentGraft,
|
|
15
16
|
handleGraft,
|
|
@@ -18,6 +19,7 @@ import {
|
|
|
18
19
|
lastRequestIds,
|
|
19
20
|
parsePageKey,
|
|
20
21
|
prependToFragment,
|
|
22
|
+
receiveResponse,
|
|
21
23
|
removePage,
|
|
22
24
|
saveAndProcessPage,
|
|
23
25
|
saveFragment,
|
|
@@ -29,8 +31,9 @@ import {
|
|
|
29
31
|
streamPrepend,
|
|
30
32
|
streamSave,
|
|
31
33
|
ujsHandlers,
|
|
34
|
+
unproxy,
|
|
32
35
|
urlToPageKey
|
|
33
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-EU2SLL5L.mjs";
|
|
34
37
|
|
|
35
38
|
// node_modules/lodash/lodash.js
|
|
36
39
|
var require_lodash = __commonJS({
|
|
@@ -740,7 +743,7 @@ var require_lodash = __commonJS({
|
|
|
740
743
|
var reIsNative = RegExp2(
|
|
741
744
|
"^" + funcToString.call(hasOwnProperty).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
|
|
742
745
|
);
|
|
743
|
-
var Buffer = moduleExports ? context.Buffer : undefined2,
|
|
746
|
+
var Buffer = moduleExports ? context.Buffer : undefined2, Symbol = context.Symbol, Uint8Array = context.Uint8Array, allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined2, getPrototype = overArg(Object2.getPrototypeOf, Object2), objectCreate = Object2.create, propertyIsEnumerable = objectProto.propertyIsEnumerable, splice = arrayProto.splice, spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined2, symIterator = Symbol ? Symbol.iterator : undefined2, symToStringTag = Symbol ? Symbol.toStringTag : undefined2;
|
|
744
747
|
var defineProperty = function() {
|
|
745
748
|
try {
|
|
746
749
|
var func = getNative(Object2, "defineProperty");
|
|
@@ -755,7 +758,7 @@ var require_lodash = __commonJS({
|
|
|
755
758
|
var metaMap = WeakMap2 && new WeakMap2();
|
|
756
759
|
var realNames = {};
|
|
757
760
|
var dataViewCtorString = toSource(DataView), mapCtorString = toSource(Map), promiseCtorString = toSource(Promise2), setCtorString = toSource(Set2), weakMapCtorString = toSource(WeakMap2);
|
|
758
|
-
var symbolProto =
|
|
761
|
+
var symbolProto = Symbol ? Symbol.prototype : undefined2, symbolValueOf = symbolProto ? symbolProto.valueOf : undefined2, symbolToString = symbolProto ? symbolProto.toString : undefined2;
|
|
759
762
|
function lodash(value) {
|
|
760
763
|
if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
|
|
761
764
|
if (value instanceof LodashWrapper) {
|
|
@@ -5526,212 +5529,6 @@ import { useSelector as useSelector3 } from "react-redux";
|
|
|
5526
5529
|
// lib/hooks/useContent.tsx
|
|
5527
5530
|
import { useSelector } from "react-redux";
|
|
5528
5531
|
import { useMemo, useRef } from "react";
|
|
5529
|
-
|
|
5530
|
-
// lib/utils/proxy.ts
|
|
5531
|
-
var ORIGINAL_TARGET = Symbol("@@originalTarget");
|
|
5532
|
-
var ARRAY_GETTER_METHODS = /* @__PURE__ */ new Set([
|
|
5533
|
-
Symbol.iterator,
|
|
5534
|
-
"at",
|
|
5535
|
-
"concat",
|
|
5536
|
-
"entries",
|
|
5537
|
-
"every",
|
|
5538
|
-
"filter",
|
|
5539
|
-
"find",
|
|
5540
|
-
"findIndex",
|
|
5541
|
-
"flat",
|
|
5542
|
-
"flatMap",
|
|
5543
|
-
"forEach",
|
|
5544
|
-
"includes",
|
|
5545
|
-
"indexOf",
|
|
5546
|
-
"join",
|
|
5547
|
-
"keys",
|
|
5548
|
-
"lastIndexOf",
|
|
5549
|
-
"map",
|
|
5550
|
-
"reduce",
|
|
5551
|
-
"reduceRight",
|
|
5552
|
-
"slice",
|
|
5553
|
-
"some",
|
|
5554
|
-
"toString",
|
|
5555
|
-
"values"
|
|
5556
|
-
]);
|
|
5557
|
-
var ARRAY_SETTER_METHODS = /* @__PURE__ */ new Set([
|
|
5558
|
-
"copyWithin",
|
|
5559
|
-
"fill",
|
|
5560
|
-
"pop",
|
|
5561
|
-
"push",
|
|
5562
|
-
"reverse",
|
|
5563
|
-
"shift",
|
|
5564
|
-
"sort",
|
|
5565
|
-
"splice",
|
|
5566
|
-
"unshift"
|
|
5567
|
-
]);
|
|
5568
|
-
function isArraySetter(prop) {
|
|
5569
|
-
return ARRAY_SETTER_METHODS.has(prop);
|
|
5570
|
-
}
|
|
5571
|
-
function isArrayGetter(prop) {
|
|
5572
|
-
return ARRAY_GETTER_METHODS.has(prop);
|
|
5573
|
-
}
|
|
5574
|
-
function convertToInt(prop) {
|
|
5575
|
-
if (typeof prop === "symbol") return null;
|
|
5576
|
-
const num = Number(prop);
|
|
5577
|
-
return Number.isInteger(num) ? num : null;
|
|
5578
|
-
}
|
|
5579
|
-
function isFragmentReference(value) {
|
|
5580
|
-
return !!value && typeof value === "object" && "__id" in value && typeof value.__id === "string";
|
|
5581
|
-
}
|
|
5582
|
-
function createArrayProxy(arrayData, fragments, dependencies, proxyCache) {
|
|
5583
|
-
if (proxyCache && proxyCache.has(arrayData)) {
|
|
5584
|
-
return proxyCache.get(arrayData);
|
|
5585
|
-
}
|
|
5586
|
-
const proxy = new Proxy(arrayData, {
|
|
5587
|
-
get(target, prop) {
|
|
5588
|
-
if (prop === ORIGINAL_TARGET) {
|
|
5589
|
-
return target;
|
|
5590
|
-
}
|
|
5591
|
-
if (isArrayGetter(prop)) {
|
|
5592
|
-
const method = target[prop];
|
|
5593
|
-
if (typeof method === "function") {
|
|
5594
|
-
return function(...args) {
|
|
5595
|
-
return Reflect.apply(method, proxy, args);
|
|
5596
|
-
};
|
|
5597
|
-
}
|
|
5598
|
-
return method;
|
|
5599
|
-
}
|
|
5600
|
-
if (isArraySetter(prop)) {
|
|
5601
|
-
throw new Error(
|
|
5602
|
-
`Cannot mutate proxy array. Use Redux actions to update state.`
|
|
5603
|
-
);
|
|
5604
|
-
}
|
|
5605
|
-
const index = convertToInt(prop);
|
|
5606
|
-
if (index !== null && index >= 0 && index < target.length) {
|
|
5607
|
-
const item = target[index];
|
|
5608
|
-
if (isFragmentReference(item)) {
|
|
5609
|
-
dependencies.add(item.__id);
|
|
5610
|
-
const fragmentData = fragments.current[item.__id];
|
|
5611
|
-
if (!fragmentData) {
|
|
5612
|
-
throw new Error(`Fragment with id "${item.__id}" not found`);
|
|
5613
|
-
}
|
|
5614
|
-
return createProxy(fragmentData, fragments, dependencies, proxyCache);
|
|
5615
|
-
}
|
|
5616
|
-
if (typeof item === "object" && item !== null) {
|
|
5617
|
-
if ("$$typeof" in item) {
|
|
5618
|
-
return item;
|
|
5619
|
-
} else {
|
|
5620
|
-
return createProxy(
|
|
5621
|
-
item,
|
|
5622
|
-
fragments,
|
|
5623
|
-
dependencies,
|
|
5624
|
-
proxyCache
|
|
5625
|
-
);
|
|
5626
|
-
}
|
|
5627
|
-
}
|
|
5628
|
-
return item;
|
|
5629
|
-
}
|
|
5630
|
-
return Reflect.get(target, prop);
|
|
5631
|
-
},
|
|
5632
|
-
has(target, prop) {
|
|
5633
|
-
if (prop === ORIGINAL_TARGET) {
|
|
5634
|
-
return true;
|
|
5635
|
-
}
|
|
5636
|
-
return Reflect.has(target, prop);
|
|
5637
|
-
},
|
|
5638
|
-
set() {
|
|
5639
|
-
throw new Error(
|
|
5640
|
-
"Cannot mutate proxy array. Use Redux actions to update state."
|
|
5641
|
-
);
|
|
5642
|
-
},
|
|
5643
|
-
deleteProperty() {
|
|
5644
|
-
throw new Error(
|
|
5645
|
-
"Cannot delete properties on proxy array. Use Redux actions to update state."
|
|
5646
|
-
);
|
|
5647
|
-
},
|
|
5648
|
-
defineProperty() {
|
|
5649
|
-
throw new Error(
|
|
5650
|
-
"Cannot define properties on proxy array. Use Redux actions to update state."
|
|
5651
|
-
);
|
|
5652
|
-
}
|
|
5653
|
-
});
|
|
5654
|
-
if (proxyCache) {
|
|
5655
|
-
proxyCache.set(arrayData, proxy);
|
|
5656
|
-
}
|
|
5657
|
-
return proxy;
|
|
5658
|
-
}
|
|
5659
|
-
function createObjectProxy(objectData, fragments, dependencies, proxyCache) {
|
|
5660
|
-
if (proxyCache && proxyCache.has(objectData)) {
|
|
5661
|
-
return proxyCache.get(objectData);
|
|
5662
|
-
}
|
|
5663
|
-
const proxy = new Proxy(objectData, {
|
|
5664
|
-
get(target, prop) {
|
|
5665
|
-
if (prop === ORIGINAL_TARGET) {
|
|
5666
|
-
return target;
|
|
5667
|
-
}
|
|
5668
|
-
const value = target[prop];
|
|
5669
|
-
if (isFragmentReference(value)) {
|
|
5670
|
-
dependencies.add(value.__id);
|
|
5671
|
-
const fragmentData = fragments.current[value.__id];
|
|
5672
|
-
if (!fragmentData) {
|
|
5673
|
-
throw new Error(`Fragment with id "${value.__id}" not found`);
|
|
5674
|
-
}
|
|
5675
|
-
return createProxy(fragmentData, fragments, dependencies, proxyCache);
|
|
5676
|
-
}
|
|
5677
|
-
if (typeof value === "object" && value !== null) {
|
|
5678
|
-
if ("$$typeof" in value) {
|
|
5679
|
-
return value;
|
|
5680
|
-
} else if (Array.isArray(value)) {
|
|
5681
|
-
return createArrayProxy(value, fragments, dependencies, proxyCache);
|
|
5682
|
-
} else {
|
|
5683
|
-
return createObjectProxy(value, fragments, dependencies, proxyCache);
|
|
5684
|
-
}
|
|
5685
|
-
}
|
|
5686
|
-
return value;
|
|
5687
|
-
},
|
|
5688
|
-
has(target, prop) {
|
|
5689
|
-
if (prop === ORIGINAL_TARGET) {
|
|
5690
|
-
return true;
|
|
5691
|
-
}
|
|
5692
|
-
return Reflect.has(target, prop);
|
|
5693
|
-
},
|
|
5694
|
-
set() {
|
|
5695
|
-
throw new Error(
|
|
5696
|
-
"Cannot mutate proxy object. Use Redux actions to update state."
|
|
5697
|
-
);
|
|
5698
|
-
},
|
|
5699
|
-
deleteProperty() {
|
|
5700
|
-
throw new Error(
|
|
5701
|
-
"Cannot delete properties on proxy object. Use Redux actions to update state."
|
|
5702
|
-
);
|
|
5703
|
-
},
|
|
5704
|
-
defineProperty() {
|
|
5705
|
-
throw new Error(
|
|
5706
|
-
"Cannot define properties on proxy object. Use Redux actions to update state."
|
|
5707
|
-
);
|
|
5708
|
-
}
|
|
5709
|
-
});
|
|
5710
|
-
if (proxyCache) {
|
|
5711
|
-
proxyCache.set(objectData, proxy);
|
|
5712
|
-
}
|
|
5713
|
-
return proxy;
|
|
5714
|
-
}
|
|
5715
|
-
function createProxy(content, fragments, dependencies, proxyCache) {
|
|
5716
|
-
if (!content || typeof content !== "object") {
|
|
5717
|
-
return content;
|
|
5718
|
-
}
|
|
5719
|
-
if ("$$typeof" in content) {
|
|
5720
|
-
return content;
|
|
5721
|
-
}
|
|
5722
|
-
if (Array.isArray(content)) {
|
|
5723
|
-
return createArrayProxy(content, fragments, dependencies, proxyCache);
|
|
5724
|
-
}
|
|
5725
|
-
return createObjectProxy(content, fragments, dependencies, proxyCache);
|
|
5726
|
-
}
|
|
5727
|
-
function unproxy(proxy) {
|
|
5728
|
-
if (proxy && typeof proxy === "object" && ORIGINAL_TARGET in proxy) {
|
|
5729
|
-
return proxy[ORIGINAL_TARGET];
|
|
5730
|
-
}
|
|
5731
|
-
return proxy;
|
|
5732
|
-
}
|
|
5733
|
-
|
|
5734
|
-
// lib/hooks/useContent.tsx
|
|
5735
5532
|
function useContent(fragmentRef, options) {
|
|
5736
5533
|
const superglueState = useSuperglue();
|
|
5737
5534
|
const currentPageKey = superglueState.currentPageKey;
|
|
@@ -5955,7 +5752,6 @@ var NavigationProvider = forwardRef(function NavigationProvider2({ history, visi
|
|
|
5955
5752
|
hash: location.hash
|
|
5956
5753
|
},
|
|
5957
5754
|
{
|
|
5958
|
-
pageKey: nextPageKey,
|
|
5959
5755
|
superglue: true,
|
|
5960
5756
|
posY: window.pageYOffset,
|
|
5961
5757
|
posX: window.pageXOffset
|
|
@@ -5964,7 +5760,7 @@ var NavigationProvider = forwardRef(function NavigationProvider2({ history, visi
|
|
|
5964
5760
|
}
|
|
5965
5761
|
}
|
|
5966
5762
|
if (state && "superglue" in state) {
|
|
5967
|
-
const
|
|
5763
|
+
const pageKey = urlToPageKey(location.pathname + location.search);
|
|
5968
5764
|
const prevPageKey = store.getState().superglue.currentPageKey;
|
|
5969
5765
|
const containsKey = !!pages[pageKey];
|
|
5970
5766
|
if (containsKey) {
|
|
@@ -6013,7 +5809,6 @@ var NavigationProvider = forwardRef(function NavigationProvider2({ history, visi
|
|
|
6013
5809
|
const historyArgs = [
|
|
6014
5810
|
path,
|
|
6015
5811
|
{
|
|
6016
|
-
pageKey: nextPageKey,
|
|
6017
5812
|
superglue: true,
|
|
6018
5813
|
posY: 0,
|
|
6019
5814
|
posX: 0
|
|
@@ -6072,17 +5867,6 @@ var NavigationProvider = forwardRef(function NavigationProvider2({ history, visi
|
|
|
6072
5867
|
});
|
|
6073
5868
|
|
|
6074
5869
|
// lib/reducers/index.ts
|
|
6075
|
-
function addPlaceholdersToDeferredNodes(existingPage, page) {
|
|
6076
|
-
const { defers = [] } = existingPage;
|
|
6077
|
-
const prevDefers = defers.map(({ path }) => {
|
|
6078
|
-
const node = getIn(existingPage, path);
|
|
6079
|
-
const copy = JSON.stringify(node);
|
|
6080
|
-
return [path, JSON.parse(copy)];
|
|
6081
|
-
});
|
|
6082
|
-
return prevDefers.reduce((memo, [path, node]) => {
|
|
6083
|
-
return setIn(page, path, node);
|
|
6084
|
-
}, page);
|
|
6085
|
-
}
|
|
6086
5870
|
function constrainPagesSize(state) {
|
|
6087
5871
|
const { maxPages } = config;
|
|
6088
5872
|
const allPageKeys = Object.keys(state);
|
|
@@ -6095,14 +5879,10 @@ function constrainPagesSize(state) {
|
|
|
6095
5879
|
}
|
|
6096
5880
|
function handleSaveResponse(state, pageKey, page) {
|
|
6097
5881
|
state = { ...state };
|
|
6098
|
-
|
|
5882
|
+
const nextPage = {
|
|
6099
5883
|
...page,
|
|
6100
5884
|
savedAt: Date.now()
|
|
6101
5885
|
};
|
|
6102
|
-
const existingPage = state[pageKey];
|
|
6103
|
-
if (existingPage) {
|
|
6104
|
-
nextPage = addPlaceholdersToDeferredNodes(existingPage, nextPage);
|
|
6105
|
-
}
|
|
6106
5886
|
constrainPagesSize(state);
|
|
6107
5887
|
state[pageKey] = nextPage;
|
|
6108
5888
|
return state;
|
|
@@ -6297,6 +6077,9 @@ var prepareStore = (store, initialPage, path) => {
|
|
|
6297
6077
|
pageKey: initialPageKey
|
|
6298
6078
|
})
|
|
6299
6079
|
);
|
|
6080
|
+
store.dispatch(
|
|
6081
|
+
receiveResponse({ pageKey: initialPageKey, response: initialPage })
|
|
6082
|
+
);
|
|
6300
6083
|
store.dispatch(saveAndProcessPage(initialPageKey, initialPage));
|
|
6301
6084
|
store.dispatch(setCSRFToken({ csrfToken }));
|
|
6302
6085
|
};
|
|
@@ -6378,6 +6161,7 @@ export {
|
|
|
6378
6161
|
getIn,
|
|
6379
6162
|
pageReducer,
|
|
6380
6163
|
prepareStore,
|
|
6164
|
+
receiveResponse,
|
|
6381
6165
|
removePage,
|
|
6382
6166
|
rootReducer,
|
|
6383
6167
|
saveAndProcessPage,
|