-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Ensure Sortable is recreated when card editors are reopened #10382
Conversation
Hello @cnorick, When attempting to inspect the commits of your pull request for CLA signature status among all authors we encountered commit(s) which were not linked to a GitHub account, thus not allowing us to determine their status(es). The commits that are missing a linked GitHub account are the following:
Unfortunately, we are unable to accept this pull request until this situation is corrected. Here are your options:
We apologize for this inconvenience, especially since it usually bites new contributors to Home Assistant. We hope you understand the need for us to protect ourselves and the great community we all have built legally. The best thing to come out of this is that you only need to fix this once and it benefits the entire Home Assistant and GitHub community. Thanks, I look forward to checking this PR again soon! ❤️ |
3c2a6cf
to
1a451e1
Compare
Co-authored-by: Bram Kragten <mail@bramkragten.nl>
try { | ||
Sortable.mount(OnSpill); | ||
Sortable.mount(new AutoScroll()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should not do this in firstUpdated
, or we should keep a flag outside the class to keep track if we mounted
this already.
But ideally we would import sortable dynamic, like we do in the sidebar and in the shopping list card.
if (!Sortable) {
const sortableImport = await import(
"sortablejs/modular/sortable.core.esm"
);
Sortable = sortableImport.Sortable;
Sortable.mount(sortableImport.OnSpill);
Sortable.mount(sortableImport.AutoScroll());
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated. Let me know what you think.
ccbb6a5
to
739ff1a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much better!
Breaking change
Proposed change
Allow sorting in lovelace card editors when they are closed and reopened.
Type of change
Example configuration
Additional information
Sortable.mount
in a try catch because it throws an error when re-registering plugins when the card is re-openedChecklist
If user exposed functionality or configuration variables are added/changed:
Demo