@metron-labs/quote-react 0.1.32 → 0.1.33
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/app/QuickQuote.js +7 -5
- package/dist/embed/quote.js +3 -3
- package/package.json +1 -1
package/dist/app/QuickQuote.js
CHANGED
|
@@ -97,7 +97,10 @@ function QuickQuoteInner({ fullPage = false, hideHeader = false, internal = fals
|
|
|
97
97
|
// Our own state only - copying the host's (e.g. Turbolinks' restoration id) makes its
|
|
98
98
|
// router treat back/forward between our steps as its page visits and re-render the page,
|
|
99
99
|
// wiping the quote. Next.js's patched pushState adds its own fields back.
|
|
100
|
-
|
|
100
|
+
// New results while the URL still carries one of our steps (start over, or the host
|
|
101
|
+
// re-rendered the page under us) reuse that entry, or back would land on a stale copy.
|
|
102
|
+
const stale = next === "results" && (window.location.hash === "#matched-products" || window.location.hash === "#quote-request");
|
|
103
|
+
window.history[stale ? "replaceState" : "pushState"]({ boqQuoteStage: next }, "", url);
|
|
101
104
|
}, []);
|
|
102
105
|
useEffect(() => {
|
|
103
106
|
const onPopState = () => {
|
|
@@ -127,11 +130,10 @@ function QuickQuoteInner({ fullPage = false, hideHeader = false, internal = fals
|
|
|
127
130
|
setStage("basket");
|
|
128
131
|
}, [writeQuoteHistory]);
|
|
129
132
|
const backToResults = useCallback(() => {
|
|
133
|
+
// Step back over the basket entry goToBasket pushed (popstate picks the screen), rather
|
|
134
|
+
// than rewriting it: each rewrite left an extra results entry the browser back had to cross.
|
|
130
135
|
if (window.location.hash === "#quote-request") {
|
|
131
|
-
|
|
132
|
-
url.hash = "matched-products";
|
|
133
|
-
window.history.replaceState({ boqQuoteStage: "results" }, "", url);
|
|
134
|
-
setStage("results");
|
|
136
|
+
window.history.back();
|
|
135
137
|
return;
|
|
136
138
|
}
|
|
137
139
|
setStage(scheduleResult ? "results" : "entry");
|