re-frame-10x
re-frame-10x copied to clipboard
Ability to configure re-frame-10x through project.clj
We have a bunch of events (periodically polling ones) that we always want to ignore. Right now every developer has to manually enter these into the re-frame-10x settings panel. It would be very nice to be able to keep this config in version control, perhaps by allowing configuration in project.clj (that is then overridable in the re-frame-10x panel?).
I think something similar to how cljs-devtools solves this would be nice: https://github.com/binaryage/cljs-devtools/blob/master/docs/configuration.md
Example config:
...
:compiler
{:output-to "..."
:output-dir "..."
:main "..."
:external-config
{:re-frame-10x/config
{:epochs-to-retain 10
:ignore-epochs-for [:my-recurring-event :my-other-recurring-event]
:sync-app-db-with-navigation true
:filter-out-traces-for-ns [:re-com.box :some-other-lib.core]
:remove-low-level-trace-for [:reagent :re-frame]}}}
I've thought about this a little bit while developing 10x, and until recently I would have been 100% for this. Now with the new AOT cache, I think this approach is going to be unsafe? I would really like to be able to do this kind of feature, but am not sure how best to do it. Closure Defines could also work, but might be a little bit ugly.
I see! In that article, it looks like :closure-defines is the recommended approach. While indeed a bit ugly, I think this functionality is worth it. It's a bit annoying though that only strings, numbers, and bools can be used for configuration since some options are best represented as a list.
I guess the config would look something like this in the defines case(?):
:closure-defines {"re_frame_10x.epochs_to_retain" 10
"re_frame_10x.ignore_epochs_for" ":my-recurring-event :my-other-recurring-event :my-third-recurring-event"
"re_frame_10x.sync_app_db_with_navigation" true
"re_frame_10x.filter_out_traces_for_ns" ":re-com.box :some-other-lib.core"
"re_frame_10x.remove-low-level-trace-for" ":reagent :re-frame"}}
@Dexterminator were you able to get the :closure-defines working? I want to get a list of ignored epochs configured for my team, but your example didn't work for me.
@carylee that was just a proposal, it hasn't been implemented yet. In the meantime, you could do something in JavaScript which wrote to local storage the default values you'd like to have. I know it's not ideal, but could be a workaround for now.
A quote from the linked article:
The AOT cache logic cannot handle the case where shipping JARs employ macros that consult the ambient environment in order to affect the code generated for the source shipped in those JARs.
Seems like it's relevant if and only if someone decides to build a full JAR with re-frame-10x and then use re-frame-10x from that JAR. I'd think that such a scenario is so rare that anyone attempting it should simply be aware of the dragons ahead and not expect anything.