Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to configure re-frame-10x through project.clj #202

Closed
Dexterminator opened this issue May 3, 2018 · 5 comments
Closed

Ability to configure re-frame-10x through project.clj #202

Dexterminator opened this issue May 3, 2018 · 5 comments

Comments

@Dexterminator
Copy link
Contributor

Dexterminator commented May 3, 2018

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]}}}
@danielcompton
Copy link
Contributor

danielcompton commented May 3, 2018

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.

@Dexterminator
Copy link
Contributor Author

Dexterminator commented May 8, 2018

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"}}

@carylee
Copy link

carylee commented Jun 11, 2018

@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.

@danielcompton
Copy link
Contributor

@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.

@p-himik
Copy link
Contributor

p-himik commented Aug 8, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants