Skip to content

Conversation

@woefe
Copy link
Contributor

@woefe woefe commented Jul 17, 2025

No description provided.

onClearRequestData(e) {
const requestPanelEl = e.target.closest('.request-panel');
const requestPanelInputEls = [...requestPanelEl.querySelectorAll('input, tag-input, textarea:not(.is-hidden)')];
const requestPanelInputEls = [...requestPanelEl.querySelectorAll('input, select, tag-input, textarea:not(.is-hidden)')];
Copy link
Member

Choose a reason for hiding this comment

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

I actually think select needs special handling, for instance what if select doesn't have a ' ' option, for optional enums for instance, the values include null not ' '. And for required enums ' ' isn't an option. Realistically we would need to select the default value in cases where the parameter is required and the nullish version that matches the property for types were it is required. I don't know if the properties already exist to figure that out from the html attributes....

Copy link
Contributor Author

@woefe woefe Jul 18, 2025

Choose a reason for hiding this comment

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

I'm not entirely sure how required parameters should behave when hide-defaults is enabled. What should be the initial value and what should "reset" reset them to? My new revision ignores the hide-defaults for required parameters and uses the defaultValue if available.

Copy link
Member

Choose a reason for hiding this comment

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

Two things also come to mind here:

  • How is "initial" different from "default" here. I think default is what these should be reset to.
  • We can never use || because that breaks nullable and falsy default values.
    I think this is going to take some more serious attention.

Rather than this latest commit, I would suggest going back to what you had before, but adding in special case handling for picking an allowed value (or null or false or '') for enums for the reset option. It might be just something like defaultValue !== undefined ? defaultValue : allowed values[0] but I haven't thought through that all the way.

Copy link
Member

@wparad wparad left a comment

Choose a reason for hiding this comment

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

@woefe woefe force-pushed the fix-clear-select branch from 7928624 to 737c6d2 Compare July 18, 2025 06:31
@wparad
Copy link
Member

wparad commented Aug 15, 2025

I'm applying this changes in #286, closing this PR.

@wparad wparad closed this Aug 15, 2025
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