paleobot / pbot-dev

Codebase and initial design documents for pbot client
MIT License
2 stars 2 forks source link

PBot schema weird things with refs #174

Closed doricon closed 11 months ago

doricon commented 11 months ago

(1) cannot add additional references (2) cannot remove references from a schema (like no x delete button) (3) cannot delete a schema - when we press submit, nothing happens. We have some old trash test schemas in there we were wanting to delete.

doricon commented 11 months ago

ignore parts 1 &2, we only allow one reference per schema.

NoisyFlowers commented 11 months ago

All of this is due to these Schemas being incomplete (lacking required fields).

The same code presents the form for all mutate modes (create/edit/delete). This means the same validation logic is applied to all nodes, even if their fields are not presented (as is the case for delete). When validation fails and the field is not presented, the code has nowhere to write the error message. So you get the Submit button appearing to do nothing.

This is only a problem when we change specs for what is required then try to delete a node that does not have required fields. Editing that node to fill in those fields prior to deleting fixes the problem.

Not sure there's anything here worth fixing in the code. I could look into differential validation based on mode, but that could be a lot of work for a situation that only arises when we change a node spec and has a workaround then.

I'm taking the high priority off this, but I'll leave it for someone else to decide whether to keep it open.

aazaff commented 11 months ago

That all makes sense and this is not the first time we've encountered this specific effect. I think that the workaround you present should be sufficient.