Skip to content

Imperative code in belongings-related components #23

@gabrc52

Description

@gabrc52

This is basically imperative code, leading to the sort of bugs that trying to write vanilla JS leads to:

I'd refactor this to use await blocks and take advantage of the fact Svelte lets you declare constants inside them (which was the reason I initially wrote the code like that, because I didn't know you could do that)

image

It's treating "loading" and "has error?" as two unrelated parts of state but they could be easily coupled with promises. Leading to this:

image

I think I'd already fixed a similar bug by changing some if statement but the advantage of writing declarative code is that you don't have to think about every branch.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions