mirror of
https://github.com/linsa-io/linsa.git
synced 2026-04-22 16:28:36 +02:00
remove fs watch v1 incorrect api use
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
"use client"
|
||||
|
||||
import React, { useEffect, ReactNode } from "react"
|
||||
import { watch, watchImmediate } from "tauri-plugin-fs-watch-api"
|
||||
|
||||
interface DeepLinkProviderProps {
|
||||
children: ReactNode
|
||||
@@ -29,32 +28,31 @@ export function DeepLinkProvider({ children }: DeepLinkProviderProps) {
|
||||
let stopWatching: (() => void) | undefined
|
||||
let stopRawWatcher: (() => void) | undefined
|
||||
|
||||
const setupFileWatchers = async () => {
|
||||
try {
|
||||
stopWatching = await watch(
|
||||
// TODO: should not hard code this, should get it from jazz
|
||||
"~/src/org/learn-anything/learn-anything.xyz/private/vaults/nikiv",
|
||||
event => {
|
||||
const { kind, path } = event
|
||||
console.log("File watch event:", { kind, path })
|
||||
},
|
||||
{ recursive: true }
|
||||
)
|
||||
// const setupFileWatchers = async () => {
|
||||
// try {
|
||||
// stopWatching = await watch(
|
||||
// // TODO: should not hard code this, should get it from jazz
|
||||
// "~/src/org/learn-anything/learn-anything.xyz/private/vaults/nikiv",
|
||||
// event => {
|
||||
// const { kind, path } = event
|
||||
// console.log("File watch event:", { kind, path })
|
||||
// },
|
||||
// { recursive: true }
|
||||
// )
|
||||
|
||||
stopRawWatcher = await watchImmediate(
|
||||
["/path/a", "/path/b"],
|
||||
event => {
|
||||
const { type, paths, attrs } = event
|
||||
console.log("Raw file watch event:", { type, paths, attrs })
|
||||
},
|
||||
{}
|
||||
)
|
||||
} catch (error) {
|
||||
console.error("Error setting up file watchers:", error)
|
||||
}
|
||||
}
|
||||
|
||||
setupFileWatchers()
|
||||
// stopRawWatcher = await watchImmediate(
|
||||
// ["/path/a", "/path/b"],
|
||||
// event => {
|
||||
// const { type, paths, attrs } = event
|
||||
// console.log("Raw file watch event:", { type, paths, attrs })
|
||||
// },
|
||||
// {}
|
||||
// )
|
||||
// } catch (error) {
|
||||
// console.error("Error setting up file watchers:", error)
|
||||
// }
|
||||
// }
|
||||
// setupFileWatchers()
|
||||
|
||||
// Cleanup function
|
||||
return () => {
|
||||
|
||||
Reference in New Issue
Block a user