Skip to content

Commit

Permalink
Reagent comp instead of re-frame sub for img loading
Browse files Browse the repository at this point in the history
Notwithstanding the bug in the previous commit, I'm unsure about what
I shall choose:

- Re-frame subscription is more declarative: you know what happen by
  reading the code, there's only on if so it's crystal clear.

- Reagent component encapsulates all the complexity: you only have the
  name to read.

- The subscription is limited to resource availability: it doesn't
  currently handle progressive loading like the component but you
  could provide it with a list of URL and it would do the same.

- If you use the sub, you get full power, hence full responsability
  over state management: you have to define the spinner. It's not
  currently implemented, but if you want to add error management, you
  must do it yourself each time.

As a conclusion, I believe the sub makes sense for the restricted case
when you merely want to check availability (you could add a
timeout). Another big advantage is its declarativeness. If you want to
actually display something and manage UX states, better to encapsulate
the sub usage into a component. From that step, it's better not to
follow re-frame sub-based approach but the reagent one.
  • Loading branch information
piotr-yuxuan committed Jul 22, 2018
1 parent 1fed5e9 commit 8fe7e9e
Show file tree
Hide file tree
Showing 3 changed files with 521 additions and 485 deletions.

0 comments on commit 8fe7e9e

Please sign in to comment.