helix

https://github.com/Lokeh/helix
dominicm 2020-11-10T16:26:55.136700Z

Curious how people are "handling" this:

(let [[error? set-error?] (hooks/use-state false)])
As set-error? is kinda confusing of a name, as it implies it should be a boolean.

ordnungswidrig 2020-11-10T19:55:34.137100Z

flip-error?:)

ordnungswidrig 2020-11-10T19:56:01.137600Z

you can always create a use-errorhook which verifies it’s a boolean

lilactown 2020-11-10T20:23:43.138300Z

I go back and forth between preferring set-error or set-error?

lilactown 2020-11-10T20:25:02.139700Z

I usually end up refactoring it anyway to a use-reducer anyway once it gets more complex so I don’t really sweat it

Aron 2020-11-10T21:15:16.140600Z

error? is a function and set-error? sets the error? predicate?

ordnungswidrig 2020-11-10T21:20:59.141100Z

set-error! and error? might be the best

Aron 2020-11-10T21:24:36.141700Z

if it sets the error state and not the predicate then set-error. it's set-error! if it mutates too.

ordnungswidrig 2020-11-10T21:35:16.142600Z

I used error state to hold the actual error and check with nil? (or some?) if there is an error condition.

ordnungswidrig 2020-11-10T21:36:23.143100Z

I trie to stay away from using booleans as much as possible 😛

1
ordnungswidrig 2020-11-11T09:29:10.150700Z

you don’t want to show the reason

dominicm 2020-11-11T10:01:00.150900Z

Nope. It's an external vendor who may have an image and if they don't they 404. There's nothing to fix.

ordnungswidrig 2020-11-11T15:13:35.153Z

But there might be a 500?

dominicm 2020-11-11T18:48:47.153500Z

If external vendor 500s, I'm still not going to show an error. This image goes directly to their service.

ordnungswidrig 2020-11-12T08:17:44.154100Z

I see.