Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 42f0394

Browse files
Fix bug where removeWidget does not function properly
1 parent fe9b219 commit 42f0394

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

‎react/lib/grid-stack-provider.tsx‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { GridStack, GridStackOptions, GridStackWidget } from "gridstack";
1+
import type { GridItemHTMLElement,GridStack, GridStackOptions, GridStackWidget } from "gridstack";
22
import { type PropsWithChildren, useCallback, useState } from "react";
33
import { GridStackContext } from "./grid-stack-context";
44

@@ -72,7 +72,12 @@ export function GridStackProvider({
7272

7373
const removeWidget = useCallback(
7474
(id: string) => {
75-
gridStack?.removeWidget(id);
75+
const element = document.body.querySelector(`[gs-id="${id}"]`);
76+
77+
if (element) {
78+
gridStack?.removeWidget(element as GridItemHTMLElement);
79+
}
80+
7681
setRawWidgetMetaMap((prev) => {
7782
const newMap = new Map<string, GridStackWidget>(prev);
7883
newMap.delete(id);

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /