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(web): simplify canvas title update mechanism #516

Merged
merged 2 commits into from
Feb 17, 2025
Merged
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: 3 additions & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ jobs:
- name: Install Dependencies
run: pnpm install

- name: Install Cypress
run: pnpm cy:install

- name: Start Middleware Containers
run: |
docker compose -f deploy/docker/docker-compose.middleware.yml up -d
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"codegen": "turbo run codegen",
"clean": "turbo run clean",
"cy:open": "cypress open",
"cy:install": "cypress install",
"lint": "biome lint .",
"lint:fix": "biome lint . --write",
"format": "biome format .",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { useSiderStoreShallow } from '@refly-packages/ai-workspace-common/stores
import { useTranslation } from 'react-i18next';
import { LOCALE } from '@refly/common-types';
import { useDebounce } from 'use-debounce';
import { useDebouncedCallback } from 'use-debounce';
import { MdOutlineImage, MdOutlineAspectRatio } from 'react-icons/md';
import { AiOutlineMenuUnfold } from 'react-icons/ai';
import { BiErrorCircle } from 'react-icons/bi';
Expand All @@ -23,7 +22,6 @@ import { CanvasRename } from './canvas-rename';
import { HoverCard } from '@refly-packages/ai-workspace-common/components/hover-card';
import { CanvasActionDropdown } from '@refly-packages/ai-workspace-common/components/workspace/canvas-list-modal/canvasActionDropdown';
import { useHoverCard } from '@refly-packages/ai-workspace-common/hooks/use-hover-card';
import { useHandleSiderData } from '@refly-packages/ai-workspace-common/hooks/use-handle-sider-data';

interface TopToolbarProps {
canvasId: string;
Expand Down Expand Up @@ -58,7 +56,6 @@ const CanvasTitle = memo(
(newTitle: string) => {
if (newTitle?.trim()) {
syncTitleToYDoc(newTitle);
updateCanvasTitle(canvasId, newTitle);
setIsModalOpen(false);
}
},
Expand All @@ -69,14 +66,9 @@ const CanvasTitle = memo(
setIsModalOpen(false);
}, []);

const { getCanvasList } = useHandleSiderData();
const debouncedRefetchCanvasList = useDebouncedCallback(async () => {
await getCanvasList();
}, 500);

// Refetch canvas list when canvas title changes
useEffect(() => {
debouncedRefetchCanvasList();
updateCanvasTitle(canvasId, canvasTitle);
}, [canvasTitle]);

return (
Expand Down
Loading