Skip to content
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 .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ apps/*/.agent
.DS_Store
*.pem

# redis dumps
*.rdb

# debug
npm-debug.log*
yarn-debug.log*
Expand Down
1 change: 0 additions & 1 deletion apps/backend/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ dependencies = [
"uvicorn[standard]>=0.35.0",
"pydantic-settings>=2.10.1",
"firebase-admin>=7.1.0",
"pymongo",
"motor>=3.7.0",
"python-jose[cryptography]>=3.5.0",
"boto3>=1.38.0",
Expand Down
18 changes: 0 additions & 18 deletions apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
"@dnd-kit/utilities": "^3.2.2",
"@hookform/resolvers": "^3",
"@monaco-editor/react": "^4.7.0",
"@pdfsmaller/pdf-decrypt": "^1.0.1",
"@pdfsmaller/pdf-encrypt": "^1.0.2",
"@peculiar/x509": "^2.0.0",
"@radix-ui/react-accordion": "^1.2.12",
"@radix-ui/react-alert-dialog": "^1.1.15",
Expand Down Expand Up @@ -50,8 +48,6 @@
"@tanstack/react-virtual": "^3.14.3",
"@vercel/analytics": "^1.5.0",
"@vercel/speed-insights": "^1.2.0",
"ajv": "^8.17.1",
"ajv-formats": "^3.0.1",
"bcryptjs": "^3.0.3",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
Expand All @@ -73,14 +69,9 @@
"ipaddr.js": "^2.3.0",
"js-md5": "^0.8.3",
"js-yaml": "^4.1.1",
"jsonpath-plus": "^10.3.0",
"jsonrepair": "^3.13.1",
"jspdf": "^4.2.1",
"jspdf-autotable": "^5.0.7",
"jszip": "^3.10.1",
"katex": "^0.16.25",
"lodash": "^4.17.21",
"lodash.debounce": "^4.0.8",
"lowlight": "^3.3.0",
"lucide-react": "^0.552.0",
"marked": "^18.0.0",
Expand All @@ -92,9 +83,6 @@
"next": "^16.2.2",
"next-intl": "^4.8.3",
"next-themes": "^0.4.6",
"novel": "^1.0.2",
"pdf-lib": "^1.17.1",
"pdfjs-dist": "4.10.38",
"pg": "^8.20.0",
"qr-code-styling": "^1.9.2",
"qrcode": "^1.5.4",
Expand All @@ -112,7 +100,6 @@
"svgo": "^4.0.0",
"tailwind-merge": "^2.6.0",
"tailwindcss-animate": "^1.0.7",
"tiptap-markdown": "^0.8.10",
"turndown": "^7.2.4",
"ua-parser-js": "^2.0.9",
"use-debounce": "^10.0.6",
Expand All @@ -126,21 +113,16 @@
"devDependencies": {
"@eslint/eslintrc": "^3",
"@next/bundle-analyzer": "^15.5.15",
"@shadcn/ui": "^0.0.4",
"@types/date-fns": "^2.6.3",
"@types/file-saver": "^2.0.7",
"@types/jest": "^30.0.0",
"@types/js-yaml": "^4.0.9",
"@types/lodash": "^4.17.20",
"@types/mime-types": "^3.0.1",
"@types/node": "^24",
"@types/pg": "^8.20.0",
"@types/qrcode": "^1.5.6",
"@types/react": "^19",
"@types/react-dom": "^19",
"@types/react-window": "^2.0.0",
"@types/turndown": "^5.0.6",
"@vitalets/google-translate-api": "^9.2.1",
"autoprefixer": "^10.4.21",
"eslint": "^9.39.4",
"eslint-config-next": "16.0.1",
Expand Down
72 changes: 29 additions & 43 deletions apps/web/src/components/snippet-manager/snippet-manager-tool.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { memo, useCallback, useEffect, useMemo, useRef, useState, type RefObject
import { useInfiniteScroll } from "@/hooks/use-infinite-scroll";
import { useAuthState } from "react-firebase-hooks/auth";
import { useTranslations } from "next-intl";
import debounce from "lodash/debounce";
import { useDebouncedCallback } from "use-debounce";
import { auth } from "@/database/firebase";
import {
createCodeSnippetApi,
Expand Down Expand Up @@ -313,52 +313,38 @@ export function SnippetManagerTool() {
const selectedIdRef = useRef(selectedId);
selectedIdRef.current = selectedId;

const debouncedSaveCode = useMemo(
() =>
debounce((code: string) => {
const id = selectedIdRef.current;
if (!id) return;
useSnippetManagerStore.getState().updateSnippet(id, { code });
const u = userRef.current;
if (u) {
void patchCodeSnippetApi(id, { code })
.then((s) =>
useSnippetManagerStore.getState().mergeSnippetFromRemote(s)
)
.catch(() => toast.error(t("toastSyncFailed")));
}
}, 450),
[t]
);

const debouncedSetLangCode = useMemo(
() => debounce((code: string) => setDebouncedCode(code), 300),
[]
);
const debouncedSaveCode = useDebouncedCallback((code: string) => {
const id = selectedIdRef.current;
if (!id) return;
useSnippetManagerStore.getState().updateSnippet(id, { code });
const u = userRef.current;
if (u) {
void patchCodeSnippetApi(id, { code })
.then((s) =>
useSnippetManagerStore.getState().mergeSnippetFromRemote(s)
)
.catch(() => toast.error(t("toastSyncFailed")));
}
}, 450);

const debouncedPersistTitleLang = useMemo(
() =>
debounce((title: string, language: string, id: string) => {
useSnippetManagerStore.getState().updateSnippet(id, { title, language });
const u = userRef.current;
if (u) {
void patchCodeSnippetApi(id, { title, language })
.then((s) =>
useSnippetManagerStore.getState().mergeSnippetFromRemote(s)
)
.catch(() => toast.error(t("toastSyncFailed")));
}
}, 400),
[t]
const debouncedSetLangCode = useDebouncedCallback(
(code: string) => setDebouncedCode(code),
300
);

useEffect(
() => () => {
debouncedSaveCode.cancel();
debouncedSetLangCode.cancel();
debouncedPersistTitleLang.cancel();
const debouncedPersistTitleLang = useDebouncedCallback(
(title: string, language: string, id: string) => {
useSnippetManagerStore.getState().updateSnippet(id, { title, language });
const u = userRef.current;
if (u) {
void patchCodeSnippetApi(id, { title, language })
.then((s) =>
useSnippetManagerStore.getState().mergeSnippetFromRemote(s)
)
.catch(() => toast.error(t("toastSyncFailed")));
}
},
[debouncedSaveCode, debouncedSetLangCode, debouncedPersistTitleLang]
400
);

const [storeHydrated, setStoreHydrated] = useState(() => {
Expand Down
Binary file removed dump.rdb
Binary file not shown.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"clean-install": "rimraf node_modules apps/*/node_modules && pnpm install"
},
"devDependencies": {
"next": "16.0.10",
"rimraf": "^6.1.0"
},
"pnpm": {
Expand Down
2 changes: 0 additions & 2 deletions test-script.js

This file was deleted.