EnCiv / undebate-ssp

Undebate Self Service Portal- Web portal where election administrators of democratically run organizations create undebates for their candidates and voters
Other
6 stars 9 forks source link

Refactor input components #128

Closed kamui-fin closed 2 years ago

kamui-fin commented 2 years ago

Currently in-progress but the PR is supposed to close #87

ddfridley commented 2 years ago

I pushed a change where onDatePickerChange sends the date up through onDone. And the story takes onDone and calls upsert, And the story pulls electionDateStory out of electionObj to be the default value for datePicker

This works, but it looks like the _count of the number of times upsert and onDone get called goes up a lot, for one change of the date. We should figure out why and reduce it. Have a look, see what you can figure out.

Thanks!

kamui-fin commented 2 years ago

I think the reason why onDone and upsert get called twice for each interaction with the calendar is because it sets off the blur event for the date input, which has its own blur handler that also calls onDone. This leads to a bunch of redundant calls I imagine.

As far as a solution goes, maybe we could try to only fire onDone if there was truly a change?