Refine NIP-88 polls code structure and reactivity #151
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The recent addition of NIP-88 Polls is a great feature (referencing issue #77 ) ! To build on that work, there are a few opportunities to streamline the component code and bring it closer to Flotilla's "Human-First Simplicity" and Svelte 5 guidelines.
This issue tracks a few minor optimizations to reduce boilerplate and performance overhead in the poll UI layer:
Proposed Improvements
PollOptioncomponent currently uses Svelte 4'stweenedfromsvelte/motioncombined with manual$effectwrappers to animate the progress bar. We can simplify this by natively binding the vote count to the<progress>element and letting DaisyUI handle the transitions.PollCreateandPollOption(e.g. for drag-and-drop logic). Extracting these into named functions within the<script>block will improve readability and align with our linter rules.PollCreatehas some verbose list-slicing logic. We should retain this convenient feature but condense the array manipulation to make it easier to maintain.NoteContentPoll.sveltetriggers an imperative networkrequestinside itsonMountexecution. Since the space sync logic (sync.ts) already handles retrievingPollResponseevents naturally, we can remove this direct fetch to preserve our unidirectional data architecture.Additional housekeeping
Verification
I would be ok with using css to interpolate progress, but everything else is unnecessary.