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

[inspector] Add refresh to replace individual set-* functions #269

Merged
merged 1 commit into from
May 14, 2024

Conversation

alexander-yakushev
Copy link
Member

@alexander-yakushev alexander-yakushev commented May 14, 2024

Currently, each config value has its own public setter with lots of repeatable code, room for error when copy-pasting, and spread documentation. Those setters are also not used when the inspector is started, so the validation does not work in that case.

This is me trying to wrangle this, to reduce the API surface, and to unify configuration between starting an inspector and changing the config in an existing one.

All existing functions are retained for compatibility and marked as deprecated.

(defn ^:deprecated set-page-size
"Use `set-config` instead."
[inspector new-page-size]
(set-config inspector {:page-size new-page-size}))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From this usage it looks like set-config should be named merge-config instead? Else it looks as if {:page-size new-page-size} would override everything

(or render-merged-config, IDK)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I'm struggling with the name. Just merge-config doesn't imply that the inspector "refreshes". render-merged-config is a bit clunky for a public function. I initially went with refresh but that doesn't highlight enough that config can be changed.

Copy link
Member Author

@alexander-yakushev alexander-yakushev May 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe something like (defn refresh [inspector config-override])?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SGTM, savvy users most certainly should be using CIDER to take a look at the arglists :)

@alexander-yakushev alexander-yakushev changed the title [inspector] Add set-config to replace individual set-* functions [inspector] Add refresh to replace individual set-* functions May 14, 2024
@alexander-yakushev alexander-yakushev merged commit 550c29b into master May 14, 2024
58 checks passed
@alexander-yakushev alexander-yakushev deleted the set-config branch May 14, 2024 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants