Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
editor: Editor,
): Types.TemplateField[] => {
const structuredContentHelpers =
(editor.helpers as any)?.structuredContentCommands;

Check warning on line 22 in src/index.tsx

View workflow job for this annotation

GitHub Actions / validate

Unexpected any. Specify a different type

if (!structuredContentHelpers?.getStructuredContentTags) {
return [];
Expand All @@ -29,7 +29,7 @@
structuredContentHelpers.getStructuredContentTags(editor.state) || [];

return tags
.map((entry: any) => {

Check warning on line 32 in src/index.tsx

View workflow job for this annotation

GitHub Actions / validate

Unexpected any. Specify a different type
const node = entry?.node ?? entry;
const attrs = node?.attrs ?? {};

Expand Down Expand Up @@ -165,7 +165,7 @@
(query: string) => {
setMenuQuery(query);
setMenuFilteredFields(computeFilteredFields(query));
},

Check warning on line 168 in src/index.tsx

View workflow job for this annotation

GitHub Actions / validate

The 'availableFields' logical expression could make the dependencies of useCallback Hook (at line 181) change on every render. Move it inside the useCallback callback. Alternatively, wrap the initialization of 'availableFields' in its own useMemo() Hook
[computeFilteredFields],
);

Expand Down Expand Up @@ -395,7 +395,7 @@
editor.view.dispatch(tr);
};

triggerCleanupRef.current = cleanup;

Check warning on line 398 in src/index.tsx

View workflow job for this annotation

GitHub Actions / validate

Unexpected any. Specify a different type
menuTriggerFromRef.current = from;
setMenuPosition(bounds);
setMenuVisible(true);
Expand Down Expand Up @@ -472,12 +472,16 @@
initSuperDoc();

return () => {
if (superdocRef.current) {
if (typeof superdocRef.current.destroy === "function") {
superdocRef.current.destroy();
}
superdocRef.current = null;
triggerCleanupRef.current = null;
menuTriggerFromRef.current = null;

const instance = superdocRef.current;

if (instance && typeof instance.destroy === "function") {
instance.destroy();
}

superdocRef.current = null;
};
}, [
document?.source,
Expand All @@ -503,7 +507,7 @@
const createdField = await onFieldCreate(field);

if (createdField) {
insertFieldInternal("inline", {

Check warning on line 510 in src/index.tsx

View workflow job for this annotation

GitHub Actions / validate

React Hook useEffect has missing dependencies: 'resetMenuFilter', 'toolbarSettings', and 'updateMenuFilter'. Either include them or remove the dependency array
alias: createdField.label,
category: createdField.category,
metadata: createdField.metadata,
Expand Down
Loading