-
Notifications
You must be signed in to change notification settings - Fork 54
feat: allow dynamic configurations #905
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,10 +15,16 @@ import { deepMerge, lazy } from '../misc.mjs'; | |
| /** | ||
| * Get's the default configuration | ||
| */ | ||
| export const getDefaultConfig = lazy(() => | ||
| export const getDefaultConfig = lazy(config => | ||
| Object.keys(allGenerators).reduce( | ||
| (acc, k) => { | ||
| acc[k] = allGenerators[k].defaultConfiguration ?? {}; | ||
| acc[k] = | ||
| 'defaultConfiguration' in allGenerators[k] | ||
| ? typeof allGenerators[k].defaultConfiguration === 'function' | ||
| ? allGenerators[k].defaultConfiguration(config) | ||
| : allGenerators[k].defaultConfiguration | ||
| : {}; | ||
|
|
||
| return acc; | ||
| }, | ||
| /** @type {import('./types').Configuration} */ ({ | ||
|
|
@@ -138,7 +144,7 @@ export const createRunConfiguration = async options => { | |
| const merged = deepMerge( | ||
| config, | ||
| createConfigFromCLIOptions(options), | ||
| getDefaultConfig() | ||
| getDefaultConfig(config) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. CLI targets ignored for defaultsMedium Severity Dynamic defaults such as Additional Locations (1)Reviewed by Cursor Bugbot for commit 288d7d9. Configure here. |
||
| ); | ||
|
|
||
| // These need to be coerced | ||
|
|
||


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lazy cache ignores config argument
Medium Severity
getDefaultConfigis still wrapped inlazy, which memoizes the first call and ignores later arguments. After making defaults depend onconfig, a secondcreateRunConfigurationin the same process reuses the first config's dynamic values (for exampleshowSearchBox) instead of recomputing them.Reviewed by Cursor Bugbot for commit 288d7d9. Configure here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
createRunConfigurationis only called once per thread, most of the timeconfigdoesn't change