Skip to content

Commit

Permalink
Disable access manager reload events
Browse files Browse the repository at this point in the history
  • Loading branch information
1whatleytay committed Nov 16, 2024
1 parent ed4683b commit 66f6e26
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 24 deletions.
14 changes: 7 additions & 7 deletions src-tauri/src/access_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,16 +126,16 @@ impl AccessManager {

match event.kind {
notify::EventKind::Create(_) => {
app.emit_all("save:create", path).ok();
// app.emit_all("save:create", path).ok();
}
notify::EventKind::Remove(_) => {
app.emit_all("save:remove", path).ok();
// app.emit_all("save:remove", path).ok();
}
notify::EventKind::Modify(ModifyKind::Name(_)) => {
if path.exists() {
app.emit_all("save:create", path).ok();
// app.emit_all("save:create", path).ok();
} else {
app.emit_all("save:remove", path).ok();
// app.emit_all("save:remove", path).ok();
}
}
notify::EventKind::Modify(ModifyKind::Data(_) | ModifyKind::Any) => {
Expand All @@ -145,9 +145,9 @@ impl AccessManager {
}

if let Ok(data) = fs::read_to_string(path) {
app.emit_all("save:modify", AccessModify {
path: path.to_string_lossy().to_string(), data: Text(data)
}).ok();
// app.emit_all("save:modify", AccessModify {
// path: path.to_string_lossy().to_string(), data: Text(data)
// }).ok();
}
}
_ => {}
Expand Down
34 changes: 17 additions & 17 deletions src/utils/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,23 +282,23 @@ export async function setupEvents() {
}
})

await listen('save:modify', (event) => {
const modification = event.payload as {
path: string,
data: any
}

if (typeof modification.data !== 'string') {
return
}

for (const tab of tabsState.tabs) {
if (tab.path === modification.path) {
editor.value.replaceAll(modification.data)
tab.marked = false
}
}
})
// await listen('save:modify', (event) => {
// const modification = event.payload as {
// path: string,
// data: any
// }
//
// if (typeof modification.data !== 'string') {
// return
// }
//
// for (const tab of tabsState.tabs) {
// if (tab.path === modification.path) {
// editor.value.replaceAll(modification.data)
// tab.marked = false
// }
// }
// })

await appWindow.onFileDropEvent(async (event) => {
if (event.payload.type === 'drop') {
Expand Down

0 comments on commit 66f6e26

Please sign in to comment.