Skip to content

Commit

Permalink
remove unused xpath from state/url (#64)
Browse files Browse the repository at this point in the history
  • Loading branch information
bbonf authored and oktaal committed Mar 10, 2023
1 parent eaa1e25 commit 0633013
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ class MweResultsStep extends ResultsStep<MweState> {

try {
state.querySet = await this.mweService.generateQuery(state.canonicalForm.text);
state.currentQuery = state.querySet[0];
let rank = state.currentQuery?.rank ?? 1;
state.currentQuery = state.querySet[rank - 1];
state.xpath = state.currentQuery.xpath;

state.valid = true;
Expand Down Expand Up @@ -99,8 +100,9 @@ export class MultiWordExpressionsComponent extends MultiStepPageDirective<MweSta
encodeGlobalState(state: MweState) {
return Object.assign(super.encodeGlobalState(state), {
'canonicalForm': JSON.stringify(state.canonicalForm),
'currentQuery': JSON.stringify(state.currentQuery),
'xpath': state.xpath
'currentQuery': JSON.stringify({rank:state.currentQuery.rank, description:state.currentQuery.description}),
// clear the xpath expression in the URL to save space (see GH issue #47)
'xpath': '',
});
}

Expand All @@ -109,7 +111,6 @@ export class MultiWordExpressionsComponent extends MultiStepPageDirective<MweSta
selectedTreebanks: new TreebankSelection(
this.treebankService,
queryParams.selectedTreebanks ? JSON.parse(queryParams.selectedTreebanks) : undefined),
xpath: queryParams.xpath || this.defaultGlobalState.xpath,
canonicalForm: JSON.parse(queryParams.canonicalForm ?? '{}'),
currentQuery: JSON.parse(queryParams.currentQuery ?? '{}'),
valid: true
Expand Down

0 comments on commit 0633013

Please sign in to comment.