Skip to content

Conversation

@iminiscript
Copy link

This PR fixes a bug in the initialization logic of the VariantPicker component. The component's internal state for tracking selected variant indices (#checkedIndices) was not being properly set up for fieldsets that did not have an option pre-selected on initial page load.

This omission could lead to a runtime error (specifically, trying to access properties of undefined) inside the updateSelectedOption method when a user made their first selection in an uninitialized fieldset.

The fix ensures that an entry (an empty array []) is always created in this.#checkedIndices for every fieldset, guaranteeing the array structure is ready for the subsequent selection logic.

✅ What Was Fixed

The change was applied exclusively in the connectedCallback method:

Bug Fix: Inconsistent State Initialization
File: VariantPicker.js

Method: connectedCallback()

Change: Modified the logic to always push an array into this.#checkedIndices for every fieldset, even if no initial variant is checked

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.

1 participant