79363046

Date: 2025-01-16 21:03:27
Score: 1.5
Natty:
Report link

It is not very clear, how you set up everything, but maybe it is just a minor issue:

You are trying to do this.element.requestSubmit, the form is not submitting anything after a change of the filter. I am not familiar with "Polaris", but it looks like you are using radio buttons....

maybe you can try to change the code to listen for events when the selected radio changed?

export default class extends Controller {
  connect() {
    // here we start and attach the "change" event listener...
    this.element.querySelectorAll("input[type='radio']").forEach((radio) => {
      radio.addEventListener("change", this.submit.bind(this));
    });
  }

  disconnect() {
    // after the page is left, we "un-listen"
    this.element.querySelectorAll("input[type='radio']").forEach((radio) => {
      radio.removeEventListener("change", this.submit.bind(this));
    });
  }

  submit() {
    this.element.requestSubmit();
  }
}
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Ends in question mark (2):
  • Low reputation (0.5):
Posted by: Michael W.