openzim / wp1

Wikipedia 1.0 engine & selection tools
https://wp1.openzim.org
GNU General Public License v2.0
24 stars 17 forks source link

Clicking on SPARQL selection or Simple selection (new) when on existing causes 404 #570

Open audiodude opened 1 year ago

audiodude commented 1 year ago

This appears to be caused by the watch property of the component, which is watching the builderId property and calling this.getBuilder() in BaseBuilder here: https://github.com/openzim/wp1/blob/main/wp1-frontend/src/components/BaseBuilder.vue#L251

However, putting a guard clause on that method call doesn't fully resolve the issue. It avoids the 404, but the page still loads with the previous builder's information filled out in the form fields. For some reason, the BaseBuilder component is being reused, even though we are navigating to a new route. Vue Navigation Guards don't help here, because they never fire (since Vue thinks it's going to a new route).

It's unclear why Vue both treats this as a new route (which it is, as seen here) and yet still re-uses the component.

kelson42 commented 1 year ago

Not clear to me what are the reproduction steps or even the user impact. Hopefuly not too bad.

audiodude commented 1 year ago

Steps to reproduce:

  1. Go to your selections page: https://wp1.openzim.org/#/selections/user. You need to have previously created a Simple or SPARQL selection
  2. Click the Edit button next to one of the selections, it will take you to something like https://wp1.openzim.org/#/selections/sparql/0b267388-fffff-....
  3. Click on the "SPARQL Selection" or "Simple Selection" sub header (depending on what type of selection you are editing) in the secondary navigation, as if you wanted to create a new empty selection: image

Expected Result:

The page for creating a new selection loads, empty and ready for data.

Actual Result:

A 404 error occurs when the page erroneously tries to load the selection with ID undefined.

kelson42 commented 1 year ago

@audiodude Thx, indeed I confirm: image