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

[Enhancement]: Pass in (some) default settings to init!. #379

Closed
sirmspencer opened this issue Oct 13, 2022 · 2 comments
Closed

[Enhancement]: Pass in (some) default settings to init!. #379

sirmspencer opened this issue Oct 13, 2022 · 2 comments

Comments

@sirmspencer
Copy link

What do you suggest?

We have app wide events that can be ignored by all devs. It would be great if I could pass in those events so each dev doesn't need to figure that part out.

I can manage to put up a PR for that, except I am not sure how the project owner wants to handle that default value and local storage. Should I merge events on the ignore list, prefer only defaults, or prefer local storage.

@kimo-k
Copy link
Contributor

kimo-k commented Jul 3, 2023

Hey @sirmspencer, thanks for the idea.

prefer local storage

This sounds like the most reasonable to me. More specifically: if the local-storage key exists, use that. If not, save the new config value to local-storage. I think this would do the trick:

modified   src/day8/re_frame_10x/events.cljs
@@ -24,7 +24,7 @@
    (rf/inject-cofx ::local-storage/load {:key "external-window-dimensions" :or {:width 800 :height 800 :top 0 :left 0}})
    (rf/inject-cofx ::local-storage/load {:key "show-epoch-traces?" :or true})
    (rf/inject-cofx ::local-storage/load {:key "using-trace?" :or true})
-   (rf/inject-cofx ::local-storage/load {:key "ignored-events" :or {}})
+   (rf/inject-cofx ::local-storage/load {:key "ignored-events" :or (into {} (get-in project-config [:re-frame-10x :ignored-events]))})
    (rf/inject-cofx ::local-storage/load {:key "low-level-trace" :or {:reagent true :re-frame true}})
    (rf/inject-cofx ::local-storage/load {:key "filtered-view-trace" :or (let [id1 (random-uuid)
                                                                               id2  (random-uuid)]

A PR would be great, if you have an easy way to implement project-config. Otherwise, I'll get started on it in a week or so.

@kimo-k
Copy link
Contributor

kimo-k commented Jul 27, 2023

Duplicate of #202

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

2 participants