remove fs watch v1 incorrect api use

This commit is contained in:
Nikita
2024-09-05 11:56:44 +03:00
parent 217f4f15e3
commit 60ac19651a
3 changed files with 139 additions and 143 deletions
+5 -5
View File
@@ -1,7 +1,7 @@
"use client" "use client"
import { useAccount } from "@/lib/providers/jazz-provider" import { useAccount } from "@/lib/providers/jazz-provider"
import { open } from "@tauri-apps/plugin-dialog" // import { open } from "@tauri-apps/plugin-dialog"
export default function TauriRoute() { export default function TauriRoute() {
const { me } = useAccount({ const { me } = useAccount({
@@ -12,7 +12,7 @@ export default function TauriRoute() {
// TODO: ugly code, just to get folder connecting working // TODO: ugly code, just to get folder connecting working
return ( return (
<div className="mb-5 flex flex-col"> <div className="mb-5 flex flex-col">
{me?.root?.connectedFolderPath && ( {/* {me?.root?.connectedFolderPath && (
<div className="flex flex-col gap-4"> <div className="flex flex-col gap-4">
<div>Connected folder: {me.root.connectedFolderPath}</div> <div>Connected folder: {me.root.connectedFolderPath}</div>
<button <button
@@ -39,8 +39,8 @@ export default function TauriRoute() {
Disconnect folder Disconnect folder
</button> </button>
</div> </div>
)} )} */}
{!me?.root?.connectedFolderPath && ( {/* {!me?.root?.connectedFolderPath && (
<button <button
onClick={async () => { onClick={async () => {
const folderPath = await open({ const folderPath = await open({
@@ -55,7 +55,7 @@ export default function TauriRoute() {
> >
Connect folder Connect folder
</button> </button>
)} )} */}
{/* TODO: loads a lot more data than expected */} {/* TODO: loads a lot more data than expected */}
{/* {JSON.stringify(me?.root?.personalPages)} */} {/* {JSON.stringify(me?.root?.personalPages)} */}
</div> </div>
+24 -26
View File
@@ -1,7 +1,6 @@
"use client" "use client"
import React, { useEffect, ReactNode } from "react" import React, { useEffect, ReactNode } from "react"
import { watch, watchImmediate } from "tauri-plugin-fs-watch-api"
interface DeepLinkProviderProps { interface DeepLinkProviderProps {
children: ReactNode children: ReactNode
@@ -29,32 +28,31 @@ export function DeepLinkProvider({ children }: DeepLinkProviderProps) {
let stopWatching: (() => void) | undefined let stopWatching: (() => void) | undefined
let stopRawWatcher: (() => void) | undefined let stopRawWatcher: (() => void) | undefined
const setupFileWatchers = async () => { // const setupFileWatchers = async () => {
try { // try {
stopWatching = await watch( // stopWatching = await watch(
// TODO: should not hard code this, should get it from jazz // // TODO: should not hard code this, should get it from jazz
"~/src/org/learn-anything/learn-anything.xyz/private/vaults/nikiv", // "~/src/org/learn-anything/learn-anything.xyz/private/vaults/nikiv",
event => { // event => {
const { kind, path } = event // const { kind, path } = event
console.log("File watch event:", { kind, path }) // console.log("File watch event:", { kind, path })
}, // },
{ recursive: true } // { recursive: true }
) // )
stopRawWatcher = await watchImmediate( // stopRawWatcher = await watchImmediate(
["/path/a", "/path/b"], // ["/path/a", "/path/b"],
event => { // event => {
const { type, paths, attrs } = event // const { type, paths, attrs } = event
console.log("Raw file watch event:", { type, paths, attrs }) // console.log("Raw file watch event:", { type, paths, attrs })
}, // },
{} // {}
) // )
} catch (error) { // } catch (error) {
console.error("Error setting up file watchers:", error) // console.error("Error setting up file watchers:", error)
} // }
} // }
// setupFileWatchers()
setupFileWatchers()
// Cleanup function // Cleanup function
return () => { return () => {
+110 -112
View File
@@ -1,114 +1,112 @@
{ {
"name": "web", "name": "web",
"version": "0.1.0", "version": "0.1.0",
"scripts": { "scripts": {
"dev": "next dev", "dev": "next dev",
"build": "next build", "build": "next build",
"start": "next start", "start": "next start",
"lint": "next lint", "lint": "next lint",
"test": "jest" "test": "jest"
}, },
"dependencies": { "dependencies": {
"@clerk/nextjs": "^5.4.1", "@clerk/nextjs": "^5.4.1",
"@dnd-kit/core": "^6.1.0", "@dnd-kit/core": "^6.1.0",
"@dnd-kit/sortable": "^8.0.0", "@dnd-kit/sortable": "^8.0.0",
"@hookform/resolvers": "^3.9.0", "@hookform/resolvers": "^3.9.0",
"@nothing-but/force-graph": "^0.8.3", "@nothing-but/force-graph": "^0.8.3",
"@omit/react-confirm-dialog": "^1.1.5", "@omit/react-confirm-dialog": "^1.1.5",
"@omit/react-fancy-switch": "^0.1.1", "@omit/react-fancy-switch": "^0.1.1",
"@radix-ui/react-avatar": "^1.1.0", "@radix-ui/react-avatar": "^1.1.0",
"@radix-ui/react-checkbox": "^1.1.1", "@radix-ui/react-checkbox": "^1.1.1",
"@radix-ui/react-context-menu": "^2.2.1", "@radix-ui/react-context-menu": "^2.2.1",
"@radix-ui/react-dialog": "^1.1.1", "@radix-ui/react-dialog": "^1.1.1",
"@radix-ui/react-dismissable-layer": "^1.1.0", "@radix-ui/react-dismissable-layer": "^1.1.0",
"@radix-ui/react-dropdown-menu": "^2.1.1", "@radix-ui/react-dropdown-menu": "^2.1.1",
"@radix-ui/react-focus-scope": "^1.1.0", "@radix-ui/react-focus-scope": "^1.1.0",
"@radix-ui/react-icons": "^1.3.0", "@radix-ui/react-icons": "^1.3.0",
"@radix-ui/react-label": "^2.1.0", "@radix-ui/react-label": "^2.1.0",
"@radix-ui/react-popover": "^1.1.1", "@radix-ui/react-popover": "^1.1.1",
"@radix-ui/react-scroll-area": "^1.1.0", "@radix-ui/react-scroll-area": "^1.1.0",
"@radix-ui/react-select": "^2.1.1", "@radix-ui/react-select": "^2.1.1",
"@radix-ui/react-separator": "^1.1.0", "@radix-ui/react-separator": "^1.1.0",
"@radix-ui/react-slot": "^1.1.0", "@radix-ui/react-slot": "^1.1.0",
"@radix-ui/react-toggle": "^1.1.0", "@radix-ui/react-toggle": "^1.1.0",
"@radix-ui/react-tooltip": "^1.1.2", "@radix-ui/react-tooltip": "^1.1.2",
"@tanstack/react-virtual": "^3.10.7", "@tanstack/react-virtual": "^3.10.7",
"@tauri-apps/plugin-fs-watch": "https://github.com/tauri-apps/tauri-plugin-fs-watch#v2", "@tiptap/core": "^2.6.6",
"@tiptap/core": "^2.6.6", "@tiptap/extension-blockquote": "^2.6.6",
"@tiptap/extension-blockquote": "^2.6.6", "@tiptap/extension-bold": "^2.6.6",
"@tiptap/extension-bold": "^2.6.6", "@tiptap/extension-bullet-list": "^2.6.6",
"@tiptap/extension-bullet-list": "^2.6.6", "@tiptap/extension-code": "^2.6.6",
"@tiptap/extension-code": "^2.6.6", "@tiptap/extension-code-block-lowlight": "^2.6.6",
"@tiptap/extension-code-block-lowlight": "^2.6.6", "@tiptap/extension-document": "^2.6.6",
"@tiptap/extension-document": "^2.6.6", "@tiptap/extension-dropcursor": "^2.6.6",
"@tiptap/extension-dropcursor": "^2.6.6", "@tiptap/extension-focus": "^2.6.6",
"@tiptap/extension-focus": "^2.6.6", "@tiptap/extension-gapcursor": "^2.6.6",
"@tiptap/extension-gapcursor": "^2.6.6", "@tiptap/extension-hard-break": "^2.6.6",
"@tiptap/extension-hard-break": "^2.6.6", "@tiptap/extension-heading": "^2.6.6",
"@tiptap/extension-heading": "^2.6.6", "@tiptap/extension-history": "^2.6.6",
"@tiptap/extension-history": "^2.6.6", "@tiptap/extension-horizontal-rule": "^2.6.6",
"@tiptap/extension-horizontal-rule": "^2.6.6", "@tiptap/extension-italic": "^2.6.6",
"@tiptap/extension-italic": "^2.6.6", "@tiptap/extension-link": "^2.6.6",
"@tiptap/extension-link": "^2.6.6", "@tiptap/extension-list-item": "^2.6.6",
"@tiptap/extension-list-item": "^2.6.6", "@tiptap/extension-ordered-list": "^2.6.6",
"@tiptap/extension-ordered-list": "^2.6.6", "@tiptap/extension-paragraph": "^2.6.6",
"@tiptap/extension-paragraph": "^2.6.6", "@tiptap/extension-placeholder": "^2.6.6",
"@tiptap/extension-placeholder": "^2.6.6", "@tiptap/extension-strike": "^2.6.6",
"@tiptap/extension-strike": "^2.6.6", "@tiptap/extension-task-item": "^2.6.6",
"@tiptap/extension-task-item": "^2.6.6", "@tiptap/extension-task-list": "^2.6.6",
"@tiptap/extension-task-list": "^2.6.6", "@tiptap/extension-text": "^2.6.6",
"@tiptap/extension-text": "^2.6.6", "@tiptap/extension-typography": "^2.6.6",
"@tiptap/extension-typography": "^2.6.6", "@tiptap/pm": "^2.6.6",
"@tiptap/pm": "^2.6.6", "@tiptap/react": "^2.6.6",
"@tiptap/react": "^2.6.6", "@tiptap/suggestion": "^2.6.6",
"@tiptap/suggestion": "^2.6.6", "axios": "^1.7.7",
"axios": "^1.7.7", "cheerio": "1.0.0",
"cheerio": "1.0.0", "class-variance-authority": "^0.7.0",
"class-variance-authority": "^0.7.0", "clsx": "^2.1.1",
"clsx": "^2.1.1", "cmdk": "^1.0.0",
"cmdk": "^1.0.0", "date-fns": "^3.6.0",
"date-fns": "^3.6.0", "framer-motion": "^11.5.2",
"framer-motion": "^11.5.2", "jazz-react": "0.7.35-unique.2",
"jazz-react": "0.7.35-unique.2", "jazz-react-auth-clerk": "0.7.33-new-auth.1",
"jazz-react-auth-clerk": "0.7.33-new-auth.1", "jazz-tools": "0.7.35-unique.2",
"jazz-tools": "0.7.35-unique.2", "jotai": "^2.9.3",
"jotai": "^2.9.3", "lowlight": "^3.1.0",
"lowlight": "^3.1.0", "lucide-react": "^0.429.0",
"lucide-react": "^0.429.0", "next": "14.2.5",
"next": "14.2.5", "next-themes": "^0.3.0",
"next-themes": "^0.3.0", "nuqs": "^1.19.0",
"nuqs": "^1.19.0", "react": "^18.3.1",
"react": "^18.3.1", "react-day-picker": "^8.10.1",
"react-day-picker": "^8.10.1", "react-dom": "^18.3.1",
"react-dom": "^18.3.1", "react-hook-form": "^7.53.0",
"react-hook-form": "^7.53.0", "react-textarea-autosize": "^8.5.3",
"react-textarea-autosize": "^8.5.3", "react-use": "^17.5.1",
"react-use": "^17.5.1", "slugify": "^1.6.6",
"slugify": "^1.6.6", "sonner": "^1.5.0",
"sonner": "^1.5.0", "streaming-markdown": "^0.0.14",
"streaming-markdown": "^0.0.14", "tailwind-merge": "^2.5.2",
"tailwind-merge": "^2.5.2", "tailwindcss-animate": "^1.0.7",
"tailwindcss-animate": "^1.0.7", "ts-node": "^10.9.2",
"tauri-plugin-fs-watch-api": "https://github.com/tauri-apps/tauri-plugin-fs-watch#v1", "zod": "^3.23.8",
"ts-node": "^10.9.2", "zsa": "^0.6.0"
"zod": "^3.23.8", },
"zsa": "^0.6.0" "devDependencies": {
}, "@testing-library/jest-dom": "^6.5.0",
"devDependencies": { "@testing-library/react": "^16.0.1",
"@testing-library/jest-dom": "^6.5.0", "@types/jest": "^29.5.12",
"@testing-library/react": "^16.0.1", "@types/node": "^22.5.3",
"@types/jest": "^29.5.12", "@types/react": "^18.3.5",
"@types/node": "^22.5.3", "@types/react-dom": "^18.3.0",
"@types/react": "^18.3.5", "eslint": "^8.57.0",
"@types/react-dom": "^18.3.0", "eslint-config-next": "14.2.5",
"eslint": "^8.57.0", "jest": "^29.7.0",
"eslint-config-next": "14.2.5", "jest-environment-jsdom": "^29.7.0",
"jest": "^29.7.0", "postcss": "^8.4.45",
"jest-environment-jsdom": "^29.7.0", "prettier-plugin-tailwindcss": "^0.6.6",
"postcss": "^8.4.45", "tailwindcss": "^3.4.10",
"prettier-plugin-tailwindcss": "^0.6.6", "ts-jest": "^29.2.5",
"tailwindcss": "^3.4.10", "typescript": "^5.5.4"
"ts-jest": "^29.2.5", }
"typescript": "^5.5.4"
}
} }