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

fix: make sure a fallback layer id is rendered in time in order to support sorting #588

Merged
merged 1 commit into from
Jan 17, 2024

Conversation

silvester-pari
Copy link
Collaborator

This PR adds an additional requestUpdate() after the initial propertyCheck(), to force the DOM to re-render. The reason for this is that SortableJS needs the layer id present in order to work correctly.

The requestUpdate() is only called in case it is needed, e.g. if the id or title were changed by the propertyCheck().

Fixes #584.

@silvester-pari silvester-pari changed the title fix: request update after initial property check fix: make sure a fallback layer id is rendered in time in order to support sorting Jan 16, 2024
Comment on lines +8 to +16
* @param {import("lit").LitElement} that - The LitElement instance.
*/
//
export default function checkProperties(collection, idProperty, titleProperty) {
export default function checkProperties(
collection,
idProperty,
titleProperty,
that
) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah, this PR looks good to me because checkProperties() is a part of /helpers, and in this case, we don't define the actual instance name like EOxLayerControlLayerList. Therefore, that seems to be the best property name, as this function can be reused in other components.

Additionally, according to the logic, it also makes sense to re-render the component if the id or title changes using requestUpdateNecessary.

@silvester-pari silvester-pari merged commit acced90 into main Jan 17, 2024
3 checks passed
@silvester-pari silvester-pari deleted the layercontrol/fix/undefined-id branch January 17, 2024 06:20
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.

Sorting removes layer in certain cases
2 participants