oops phrase URL sharing bug fixed hopefull

This commit is contained in:
lingdocs 2022-05-05 14:36:28 -05:00
parent 002cfbadda
commit 438b54d1d0
3 changed files with 13 additions and 9 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "@lingdocs/pashto-inflector", "name": "@lingdocs/pashto-inflector",
"version": "2.4.1", "version": "2.4.2",
"author": "lingdocs.com", "author": "lingdocs.com",
"description": "A Pashto inflection and verb conjugation engine, inculding React components for displaying Pashto text, inflections, and conjugations", "description": "A Pashto inflection and verb conjugation engine, inculding React components for displaying Pashto text, inflections, and conjugations",
"homepage": "https://verbs.lingdocs.com", "homepage": "https://verbs.lingdocs.com",

View File

@ -66,9 +66,19 @@ function VPExplorer(props: {
setAlert(undefined); setAlert(undefined);
}, 1500); }, 1500);
} }
// useEffect(() => {
// const newVps = makeVPSelectionState(props.verb, vps);
// adjustVps({
// type: "load vps",
// payload: newVps,
// });
// // eslint-disable-next-line
// }, [props.verb]);
useEffect(() => { useEffect(() => {
const VPSFromUrl = getVPSFromUrl(); const VPSFromUrl = getVPSFromUrl();
console.log({ VPSFromUrl });
if (VPSFromUrl) { if (VPSFromUrl) {
setMode("phrases");
adjustVps({ adjustVps({
type: "load vps", type: "load vps",
payload: VPSFromUrl payload: VPSFromUrl
@ -76,14 +86,6 @@ function VPExplorer(props: {
} }
// eslint-disable-next-line // eslint-disable-next-line
}, []); }, []);
useEffect(() => {
const newVps = makeVPSelectionState(props.verb, vps);
adjustVps({
type: "load vps",
payload: newVps,
});
// eslint-disable-next-line
}, [props.verb]);
function handleSubjectChange(subject: T.NPSelection | undefined, skipPronounConflictCheck?: boolean) { function handleSubjectChange(subject: T.NPSelection | undefined, skipPronounConflictCheck?: boolean) {
adjustVps({ adjustVps({
type: "set subject", type: "set subject",
@ -270,6 +272,7 @@ function getShareUrl(vps: T.VPSelectionState): string {
const stringJSON = JSON.stringify(vps); const stringJSON = JSON.stringify(vps);
const encoded = LZString.compressToEncodedURIComponent(stringJSON); const encoded = LZString.compressToEncodedURIComponent(stringJSON);
const url = new URL(window.location.href); const url = new URL(window.location.href);
url.searchParams.delete(phraseURLParam);
url.searchParams.append(phraseURLParam, encoded); url.searchParams.append(phraseURLParam, encoded);
return url.toString(); return url.toString();
} }

View File

@ -62,6 +62,7 @@ export function vpsReducer(vps: T.VPSelectionState, action: VpsReducerAction, se
} }
function doReduce(): T.VPSelectionState { function doReduce(): T.VPSelectionState {
if (action.type === "load vps") { if (action.type === "load vps") {
console.log("doing loading", action.payload);
return action.payload; return action.payload;
} }
if (action.type === "set subject") { if (action.type === "set subject") {