Skip to content

Conversation

YOUNGHO8762
Copy link
Contributor

@YOUNGHO8762 YOUNGHO8762 commented Sep 16, 2025

Description

resolving the issue where only the internal elements were removed when an ID was provided. Passing the element now ensures that the entire grid-stack-item-content is removed as intended.

Checklist

  • Created tests which fail without the change (if possible)
  • All tests passing (yarn test)
  • Extended the README / documentation, if necessary

@adumesny adumesny merged commit f65bb22 into gridstack:master Sep 17, 2025
const removeWidget = useCallback(
(id: string) => {
gridStack?.removeWidget(id);
const element = document.body.querySelector(`[gs-id="${id}"]`);
Copy link
Member

Choose a reason for hiding this comment

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

const element: GridItemHTMLElement = ....

woudl be better, then no casting

@adumesny
Copy link
Member

thanks for the fix. alas the compiler doesn't catch that issue since passing a string is valid, btu looks for css selectors, not gs-id attributes (which it could I suppose as fallback).

adumesny added a commit to adumesny/gridstack.js that referenced this pull request Sep 22, 2025
* might be able to use GridStack.removeWidget() which now uses gs-id as last resource....
@adumesny adumesny mentioned this pull request Sep 22, 2025
3 tasks
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.

2 participants