Skip to content
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

🚩PR: Fixed runtime error for dropdown select list #573

Merged
merged 5 commits into from
Feb 6, 2024

Conversation

elsoazemelet
Copy link
Contributor

@elsoazemelet elsoazemelet commented Jan 26, 2024

Closes #560

The fixed issue was the instable state management of MeltSelect.svelte. Fixed the selection state management logic.

Testing

The stresstesting of the select list is probably the way to go.

This component is used as a dropdown list in the following parts of editor:

  • In the tracker options (track events, elements, or off)
  • In the preferences menu
  • In the configuration menu, with the control element selection
  • In the virtual module adder modal, with the type selection

Closes #582

Test dropdown for control element selection on Configuration panel in virtual mode too. See original issue of #582

@elsoazemelet elsoazemelet changed the title Fixed runtime error for dropdown select list PR: Fixed runtime error for dropdown select list Jan 26, 2024
@elsoazemelet elsoazemelet changed the title PR: Fixed runtime error for dropdown select list 🚩PR: Fixed runtime error for dropdown select list Jan 26, 2024
@narayb
Copy link
Collaborator

narayb commented Jan 29, 2024

Seemingly works as intended.

type SelectOption = { title: string; value: any };

function getDefaultSelected() {
const obj = options.find((e: SelectOption) => e.value === target);
Copy link
Contributor Author

@elsoazemelet elsoazemelet Jan 30, 2024

Choose a reason for hiding this comment

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

Make it possible to accept invalid or undefined default target => Empty selectbox

}
function handleSelectionChange(selected: { label: string; value: any }) {
if (selected === target) {
return;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Use case:
NEVER update target if no actual selection change happened
If target is updated from the outside (correctly) change selection, (target should not change twice, in this case again from the inside)
If target is changed from the inside, propagate change to the outside.

@elsoazemelet elsoazemelet merged commit e789352 into stable Feb 6, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants