Commit a86faf2
Migrate file tree creation to Rust backend (#6)
* feat(filetree): move file tree generation logic to Rust backend
Migrates the recursive file tree building logic from the TypeScript frontend to the Rust backend to improve performance, especially for large directories.
- Implements `build_file_tree` Tauri command in Rust.
- Adds Desktop implementation using `std::fs` and `spawn_blocking`.
- Adds Android implementation using `tauri-plugin-android-fs` and `urlencoding`.
- Updates frontend `builder.ts` to invoke the Rust command.
- Preserves existing filtering logic (markdown files only, ignore hidden dirs).
* perf: optimize file tree building and sorting in Rust
- Move sorting logic inside `spawn_blocking` to avoid blocking the main thread on large directories.
- Fix compiler warnings (unused imports/variables).
- Ensure correct recursion and sorting on both Desktop and Android.
- Refactor argument names to avoid unused variable warnings across platforms.
* feat(filetree): move generation and sorting to Rust backend
Migrates file tree logic to Rust to improve performance and prevent UI freezes.
- Implements `build_file_tree` and `sort_file_tree` Tauri commands in `src-tauri/src/lib.rs`.
- Uses `spawn_blocking` to offload heavy operations from the main thread.
- Ensures compatibility with Android FS plugin (fixing compilation issues) and Desktop `std::fs`.
- Updates frontend to invoke Rust commands and safely handle auto-sorting in `$effect` without infinite loops.
- Adds `urlencoding` dependency for Android path handling.
- Cleans up deprecated JS logic.
* fix: don't use rust sort function for subsequent sorts bcuz of latency and less flexibility
so, calling rust sort function everytime for subsequent sorting seems to
have incresed latency.
also on rename or any file tree changes, the sorting was commented out.
* refac: remove unwanted legacy functions
* fix(error): show a toast error if file tree building fails
* Update apps/app/src-tauri/src/lib.rs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Update apps/app/src-tauri/src/lib.rs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Update apps/app/src-tauri/src/lib.rs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* fix: use inline type modifier for FileNode import for consistency
Co-authored-by: Keshav-writes-code <95571677+Keshav-writes-code@users.noreply.github.com>
* feat: implement natural/numeric sorting using natord crate
Co-authored-by: Keshav-writes-code <95571677+Keshav-writes-code@users.noreply.github.com>
* fix: add aria label to icon based buttons
* fix(performace): make subtree sorting happen only on rename operation not in the $effect block which slows down speed
* fix: add sorting when new element gets inserted
* refac: remove debugging statementsa
* refac: remove unwanted vairables
* chore: update deps
* chore: update deps
* fix(ui_webkit): fix strange behaviour where a previously selected item stays selected after mutate the name and path of a node
---------
Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Co-authored-by: keshav-writes-code <dhimankeshav201@gmail.com>
Co-authored-by: Keshav <95571677+Keshav-writes-code@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>1 parent 142ff0e commit a86faf2
7 files changed
Lines changed: 247 additions & 68 deletions
File tree
- apps/app
- src-tauri
- src
- src
- components/sidebar/file_manager
- lib/file_tree
- utils
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
| 34 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
1 | 192 | | |
2 | 193 | | |
3 | 194 | | |
| |||
6 | 197 | | |
7 | 198 | | |
8 | 199 | | |
| 200 | + | |
9 | 201 | | |
10 | 202 | | |
11 | 203 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
257 | 257 | | |
258 | 258 | | |
259 | 259 | | |
260 | | - | |
| 260 | + | |
261 | 261 | | |
262 | 262 | | |
263 | 263 | | |
| |||
0 commit comments