Skip to content
Open
Show file tree
Hide file tree
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
3 changes: 0 additions & 3 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

# Icons guard: when an icon SVG is added, modified or deleted, ensure the
# generated components are in sync. Same check as CI (see
# .github/workflows/icons-check.yml).
Expand Down
2 changes: 1 addition & 1 deletion packages/bootstrap/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"format": "prettier --check src/**/*.scss",
"format:write": "prettier --write src/**/*.scss",
"generate-commit-version": "node scripts/version.cjs",
"lint": "stylelint src/**/*.scss",
"lint": "stylelint src/**/*.scss --max-warnings 0",
"watch": "sass --watch --load-path=node_modules/ --style=compressed --quiet-deps --silence-deprecation=import src/index.scss dist/index.css"
},
"dependencies": {
Expand Down
4 changes: 2 additions & 2 deletions packages/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"fix": "eslint --fix --report-unused-disable-directives --max-warnings 0",
"format": "prettier --check \"src/ts/**/*.ts\"",
"format:write": "prettier --write \"src/ts/**/*.ts\"",
"lint": "eslint",
"lint": "eslint --max-warnings 0",
"test": "vitest",
"test:coverage": "vitest run --coverage"
},
Expand All @@ -61,4 +61,4 @@
"vite": "catalog:",
"vite-plugin-dts": "catalog:"
}
}
}
2 changes: 1 addition & 1 deletion packages/extensions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
"fix": "eslint --fix --report-unused-disable-directives --max-warnings 0",
"format": "prettier --check \"src/**/*.ts\"",
"format:write": "prettier --write \"src/**/*.ts\"",
"lint": "eslint"
"lint": "eslint --max-warnings 0"
},
"dependencies": {
"@edifice.io/utilities": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion packages/extensions/src/image/image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export const Image = TiptapImage.extend<CustomImageOptions>({
}
: {};
},
parseHTML: (element) => {
parseHTML: () => {
return null;
},
},
Expand Down
2 changes: 1 addition & 1 deletion packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
"fix": "eslint --fix --report-unused-disable-directives --max-warnings 0",
"format": "prettier --check \"src/**/*.{ts,tsx}\"",
"format:write": "prettier --write \"src/**/*.{ts,tsx}\"",
"lint": "eslint",
"lint": "eslint --max-warnings 0",
"test": "vitest",
"test:watch": "vitest --watch",
"test:coverage": "vitest run --coverage"
Expand Down
7 changes: 5 additions & 2 deletions packages/react/src/components/Layout/hooks/useHelp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,12 @@ export function useHelp(
const [isModalOpen, setIsModalOpen] = useState<boolean>(false);
const [error, setError] = useState<boolean>(false);
const helpPath = theme?.is1d ? '/help-1d' : '/help-2d';
// Only the truthiness matters here, so derive a stable primitive to avoid
// re-running the effect when an object prop is recreated on each render.
const isHelpEnabled = !!hasOldHelpEnableWorkflow;

useEffect(() => {
if (!hasOldHelpEnableWorkflow) {
if (!isHelpEnabled) {
return;
}

Expand Down Expand Up @@ -61,7 +64,7 @@ export function useHelp(
console.error(error);
}
})();
}, [appCode, helpPath]);
}, [appCode, helpPath, isHelpEnabled]);

const options = {
replace: (domNode: any) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {
type ComponentPropsWithoutRef,
type ReactNode,
useCallback,
useEffect,
} from 'react';

Expand Down Expand Up @@ -30,10 +31,10 @@ const PageLayoutOverlay = ({
const { t } = useTranslation();
const { isOverlayOpen, updateOverlayOpen } = useOverlay();

const handleClose = () => {
const handleClose = useCallback(() => {
updateOverlayOpen(false);
onClose?.();
};
}, [onClose, updateOverlayOpen]);

useEffect(() => {
if (!isOverlayOpen) return;
Expand All @@ -60,7 +61,6 @@ const PageLayoutOverlay = ({
className,
)}
aria-hidden={!isOverlayOpen}
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore — inert is not yet in React's HTMLAttributes but is valid HTML
inert={!isOverlayOpen ? '' : undefined}
{...props}
Expand Down
14 changes: 8 additions & 6 deletions packages/react/src/hooks/useCheckable/useCheckable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@ export const useCheckable = <T extends { _id: string }>(
useEffect(() => {
// If data changes, check if selected items are still valid
if (data) {
const validSelectedItems = selectedItems.filter((id) =>
data.some((item) => item._id === id),
);
if (validSelectedItems.length !== selectedItems.length) {
setSelectedItems(validSelectedItems);
}
setSelectedItems((currentSelection) => {
const validSelectedItems = currentSelection.filter((id) =>
data.some((item) => item._id === id),
);
return validSelectedItems.length !== currentSelection.length
? validSelectedItems
: currentSelection;
});
}
}, [data]);

Expand Down
12 changes: 6 additions & 6 deletions packages/react/src/hooks/useDate/useDate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export default function useDate() {
// format D MMM YYYY
return computedDate.format(t('date.format.previousYear'));
},
[currentLanguage, parseDate],
[t, toComputedDate],
);

/** Compute a user-friendly elapsed duration, between now and a date. */
Expand All @@ -147,7 +147,7 @@ export default function useDate() {
const computedDate = toComputedDate(date);
return computedDate?.isValid() ? computedDate.fromNow() : '';
},
[currentLanguage, parseDate],
[toComputedDate],
);

/**
Expand Down Expand Up @@ -181,7 +181,7 @@ export default function useDate() {
? computedDate.locale(currentLanguage as string).format(dayjsFormat)
: '';
},
[currentLanguage, parseDate],
[currentLanguage, toComputedDate],
);

/** Check if two dates are the same, according to the specified unit. See https://day.js.org/docs/en/query/is-same for more details.
Expand All @@ -196,7 +196,7 @@ export default function useDate() {
const computedDate2 = toComputedDate(date2);
return computedDate?.isSame(computedDate2, unit) ?? false;
},
[currentLanguage, parseDate],
[toComputedDate],
);

/** Check if a date is same or after another date. See https://day.js.org/docs/en/query/is-same-or-after for more details.
Expand All @@ -211,7 +211,7 @@ export default function useDate() {
const computedDate2 = toComputedDate(date2);
return computedDate?.isSameOrAfter(computedDate2, unit) ?? false;
},
[currentLanguage, parseDate],
[toComputedDate],
);

/** Check if a date is today. See https://day.js.org/docs/en/plugin/is-today for more details.
Expand All @@ -223,7 +223,7 @@ export default function useDate() {
const computedDate = toComputedDate(date);
return computedDate?.isToday() ?? false;
},
[currentLanguage, parseDate],
[toComputedDate],
);

return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ export const useHttpErrorToast = ({
const toast = useToast();
const { t } = useTranslation();

// Keep the latest options in a ref so the subscription always uses fresh
// values without re-subscribing on every render (options is a new object each time).
const optionsRef = useRef(options);
optionsRef.current = options;

useEffect(() => {
if (active) {
// Subscribe to HTTP error events
Expand All @@ -39,7 +44,7 @@ export const useHttpErrorToast = ({
message.current = t(i18nKey);
toast.error(
React.createElement('div', { children: [message.current] }),
options,
optionsRef.current,
);
});

Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/hooks/useUploadFiles/useUploadFiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const useUploadFiles = ({
}
});
},
[uploadAlternateFile, uploadFile, replaceFileAt],
[uploadAlternateFile, uploadFile, replaceFileAt, resetInputValue],
);

/* Try to upload more files when
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { WorkspaceElement } from '@edifice.io/client';
import { useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { useEdificeClient } from '../../providers/EdificeClientProvider/EdificeClientProvider.hook';

interface FolderTreeNode {
id: string;
Expand All @@ -14,7 +13,6 @@ export const WORKSPACE_SHARED_FOLDER_ID = 'workspace-shared-folder-id';

function useWorkspaceFoldersTree(folders?: WorkspaceElement[]) {
const { t } = useTranslation();
const { user } = useEdificeClient();

const [searchQuery, setSearchQuery] = useState('');

Expand All @@ -28,7 +26,7 @@ function useWorkspaceFoldersTree(folders?: WorkspaceElement[]) {
);

return searchQuery ? filterTree(foldersTree, searchQuery) : foldersTree;
}, [folders, searchQuery, user]);
}, [folders, searchQuery, t]);

return {
foldersTree: filtredFoldersTree,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ const CantooAdaptTextBoxView = ({
inline: 'nearest',
});
}
// Run only on mount: scroll the box into view once when it opens.
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,7 @@ export const EditorToolbar = ({
}, [
alignmentOptions,
canRecognizeSpeech,
cantooEditor,
editor,
listOptions,
mediaLibraryRef,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ export const useOnboardingModal = <T>(
state.current = undefined;
}
})();
// Run only on mount: read the stored preference once to decide whether to
// start the onboarding. Re-running on prop changes would re-open the modal.
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

const handleSavePreference = useCallback(async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ export default function WorkspaceFolders({

onFolderSelected(selectedFolderIdForAPI, canCopyFileInto);
}
// Intentionally react only to a change of the selected folder. The callback
// and helper below are merely invoked here, not meant to re-trigger it.
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [selectedFolderId]);

const handleSearchChange = (e: ChangeEvent<HTMLInputElement>) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/rest-client-base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"clean": "rm -rf dist node_modules",
"format": "prettier --check src",
"format:write": "prettier --write src",
"lint": "eslint src",
"lint": "eslint src --max-warnings 0",
"lint:fix": "eslint src --fix",
"build": "pnpm run build:node && pnpm run build:browser && pnpm run build:react-native",
"build:node": "vite build --config vite.config.node.ts && tsc src/bin/cli.ts --outDir dist/node --module commonjs --target ES2020 && mv dist/node/cli.js dist/node/cli.cjs",
Expand Down
2 changes: 1 addition & 1 deletion packages/utilities/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"fix": "eslint --fix --report-unused-disable-directives --max-warnings 0",
"format": "prettier --check \"src/**/*.ts\"",
"format:write": "prettier --write \"src/**/*.ts\"",
"lint": "eslint"
"lint": "eslint --max-warnings 0"
},
"devDependencies": {
"@types/node": "catalog:",
Expand Down
Loading