dbeaver/pro#10177 pass defaults to main properties - #4538
Conversation
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 5 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
| } | ||
|
|
||
| if (config.driverId) { | ||
| const driver = await this.dbDriverResource.load(config.driverId, ['includeMainProperties']); |
There was a problem hiding this comment.
includes is pattern we refused to support a while ago. it would be nice to create new resource DBDriverMainPropertiesResource and reuse it here
There was a problem hiding this comment.
Not scope of the ticket, code is already exist in this part
| if (config.driverId) { | ||
| const driver = await this.dbDriverResource.load(config.driverId, ['includeMainProperties']); | ||
|
|
||
| if (config.mainPropertyValues) { |
There was a problem hiding this comment.
we get config defaultStateGetter
in this helper mainPropertyValues is always an object
so this check is always true
probably there is a miss-match with the zod type here:
There was a problem hiding this comment.
yes, types are from zod schema, there mainPropertyValues is optional
| // Don't call load in create mode. There we rely on the defaults set here, and useAutoLoad will load the part on mount. | ||
| if (this.formState.mode === FormMode.Edit) { | ||
| await this.optionsPart?.load(); | ||
| } |
There was a problem hiding this comment.
Something is off here
Previously we waited for part being loaded and set initialState. And only then we went to setting driverId and all attached config to it. And it was pretty straightforward and imperative for both form modes: create and edit
Right now it smells like race condition. What if in create mode we resolve setDriverId() before the optionsPart is actually loaded and set initialState?
There was a problem hiding this comment.
What was the original issue here? Maybe we can resolve it differently?
closes 10177