Watts-Lab / researcher-portal

deliberation lab collaborator tools
0 stars 0 forks source link

[Bug]: App crashes when at least one treatment is not defined in list under treatment #98

Open shapeseas opened 1 month ago

shapeseas commented 1 month ago

What happened?

Line here. Also is in EditStage and EditElement

Can use treatment?.treatments?.[0] to resolve issue. I know this is still a work in progress with multiple treatments!

What browsers do you see the problem on?

What operating system do you see the problem on?

How did we discover the bug?

Priority

Inconvenience for researchers

evanping commented 1 month ago

I think the timeline itself should not be attempting to render anything when treatments is empty. This is similar to when we create a new stage with no elements. In both cases they should contain the empty list [].

I believe I disabled the zod validation because of the significant changes, so when we go back to reimplement that, it should prevent "saving" such treatments.

shapeseas commented 1 month ago

Not rendering on invalid treatments sense to me, but I wonder if saving should still be allowed. The trouble with not saving treatments, is maybe a user wants to save progress, but can't yet get it to render. We probably still want them to be able to save their work even if it's not yet a valid treatment. So I wonder if we introduce a "render" button and a "save" button that would accommodate two different behaviors? Open to other thoughts. Related: what are the possible input cases for the treatment? I know with templates the structure changes to have an object that is { templates: list treatments: list} and the simpler treatment structure is just {name: ,gameStages: []} I think the app should be able to accommodate both.