Fork me on GitHub
#re-frame
<
2018-12-12
>
andrea.crotti11:12:20

just checking, is this still the only way to have a global interceptor? https://github.com/Day8/re-frame/blob/master/docs/FAQs/GlobalInterceptors.md

andrea.crotti11:12:35

we would just like to add some spec validation of the app-db

andrea.crotti11:12:16

but there are hundreds of reg-event-db spread over the place, having our own wrapper could work but if there is another way would be even better

andrea.crotti11:12:17

tbh actually I think that spec validation is such a common pattern that it could be even be a re-frame feature ideally?

andrea.crotti11:12:29

only problem is how to construct the massive spec, considering it's really in theory composed instead of many layers of sub-specs

mikethompson11:12:30

And for many situations you only want to spec the area just updated.

mikethompson11:12:49

By "the area", I mean the area within app-db

mikethompson11:12:45

Although obviously checking the whole of app-db could be done each time. Just might be inefficient.

mikethompson11:12:22

I guess we haven't insisted on any approach. We've just left the pieces there for everyone to make their own decisions.

andrea.crotti12:12:13

yes ok I'll give it a go

andrea.crotti12:12:27

and well if we turn it on only for dev/test we don't really care about efficiency

andrea.crotti12:12:15

but maybe another way to register a global interceptor would be nice, even if surely someone could complain it's magic

ts150312:12:32

Hi @andrea.crotti I think add-post-event-callback is what you are looking It’s not documented feature I think ))

andrea.crotti12:12:30

uh nice @ts1503 but given it's undocumented maybe I should not use it, in case it changes/gets deleted in the future?

ts150312:12:40

In docs this feature marked like - for advanced cases. Maybe your case is advanced?)

mikethompson12:12:13

It is certainly a part of the official interface

Braden Shepherdson16:12:59

can anyone point me to an example or guidance for integrating a substantial third-party component into re-frame in a sane way? I'm looking at CodeMirror in particular, but any advice is welcome.

Braden Shepherdson16:12:29

it requires calling JS functions with an element reference once the component is mounted and so on; I've never used React directly, so I'm a bit out of my depth.

Braden Shepherdson16:12:26

being able to update the DB with, say, errors to highlight in the editor, and have a subscription cause a call to CM would be ideal.

Braden Shepherdson16:12:51

(I don't care to put the text contents into the DB in real time, I'm okay with pulling the contents on a Save button's action.)

Braden Shepherdson16:12:06

that's quite a first paragraph 😄

Braden Shepherdson16:12:54

that looks like exactly what I need, thanks!

isak16:12:27

For codemirror, in my project we did it like this: https://gist.github.com/isaksky/a96476fa51a10ba903b7c6bdcb13c85b

polymeris16:12:30

another option

mikerod22:12:45

@braden.shepherdson also https://purelyfunctional.tv/guide/re-frame-lifecycle/ is a pretty good overview of form 3 style components