Commit e4d3573
fix(knowledge): give users choice to keep or delete documents when removing connector (#3825)
* fix(knowledge): give users choice to keep or delete documents when removing connector
* refactor(knowledge): clean up connector delete and extract shared extension validator
- Extract `isAlphanumericExtension` helper to deduplicate regex across parser-extension.ts and validation.ts
- Extract `closeDeleteModal` callback to eliminate 4x scattered state resets
- Add archivedAt/deletedAt filters to UPDATE query in keep-docs delete path
- Parallelize storage file cleanup and tag definition cleanup with Promise.all
- Deduplicate URL construction in delete connector hook
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor(knowledge): remove duplicate extension list from parser-extension
Use SUPPORTED_DOCUMENT_EXTENSIONS and isSupportedExtension from
validation.ts instead of maintaining a separate identical list.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix(db): change document.connectorId FK from cascade to set null
The cascade behavior meant deleting a connector would always delete
its documents, contradicting the "keep documents" option. With set null,
the database automatically nullifies connectorId when a connector is
removed, and we only need explicit deletion when the user opts in.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* chore(db): add migration metadata for connectorId FK change
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix(knowledge): fix connector delete test and use URL-safe searchParams
Use `new URL(request.url).searchParams` instead of `request.nextUrl.searchParams`
for compatibility with test mocks. Add missing `connectorType` to test fixture.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* spacing
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>1 parent b4064c5 commit e4d3573
File tree
12 files changed
+14532
-66
lines changed- apps/sim
- app
- api/knowledge/[id]/connectors/[connectorId]
- workspace/[workspaceId]/knowledge/[id]/components
- add-connector-modal
- connectors-section
- edit-connector-modal
- hooks/queries/kb
- lib
- knowledge/documents
- uploads/utils
- packages/db
- migrations
- meta
12 files changed
+14532
-66
lines changedLines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
237 | 237 | | |
238 | 238 | | |
239 | 239 | | |
240 | | - | |
| 240 | + | |
241 | 241 | | |
242 | 242 | | |
243 | 243 | | |
| |||
Lines changed: 29 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
292 | 292 | | |
293 | 293 | | |
294 | 294 | | |
295 | | - | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
296 | 299 | | |
297 | 300 | | |
298 | 301 | | |
| |||
306 | 309 | | |
307 | 310 | | |
308 | 311 | | |
309 | | - | |
310 | | - | |
311 | | - | |
312 | | - | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
313 | 318 | | |
314 | 319 | | |
315 | 320 | | |
| |||
328 | 333 | | |
329 | 334 | | |
330 | 335 | | |
331 | | - | |
| 336 | + | |
332 | 337 | | |
333 | 338 | | |
334 | | - | |
335 | | - | |
336 | | - | |
337 | | - | |
338 | | - | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
339 | 349 | | |
340 | | - | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
341 | 353 | | |
342 | 354 | | |
343 | 355 | | |
| |||
349 | 361 | | |
350 | 362 | | |
351 | 363 | | |
352 | | - | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
353 | 369 | | |
354 | 370 | | |
355 | 371 | | |
| |||
Lines changed: 5 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
373 | 373 | | |
374 | 374 | | |
375 | 375 | | |
376 | | - | |
| 376 | + | |
377 | 377 | | |
378 | 378 | | |
379 | 379 | | |
| |||
394 | 394 | | |
395 | 395 | | |
396 | 396 | | |
397 | | - | |
| 397 | + | |
398 | 398 | | |
399 | 399 | | |
400 | 400 | | |
| |||
442 | 442 | | |
443 | 443 | | |
444 | 444 | | |
445 | | - | |
| 445 | + | |
446 | 446 | | |
447 | 447 | | |
448 | 448 | | |
| |||
507 | 507 | | |
508 | 508 | | |
509 | 509 | | |
510 | | - | |
| 510 | + | |
511 | 511 | | |
512 | 512 | | |
513 | 513 | | |
| |||
550 | 550 | | |
551 | 551 | | |
552 | 552 | | |
553 | | - | |
| 553 | + | |
554 | 554 | | |
555 | 555 | | |
556 | 556 | | |
| |||
Lines changed: 29 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
77 | 78 | | |
78 | 79 | | |
79 | 80 | | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
80 | 87 | | |
81 | 88 | | |
82 | 89 | | |
| |||
224 | 231 | | |
225 | 232 | | |
226 | 233 | | |
227 | | - | |
| 234 | + | |
228 | 235 | | |
229 | | - | |
| 236 | + | |
230 | 237 | | |
231 | 238 | | |
232 | | - | |
233 | | - | |
234 | | - | |
235 | | - | |
236 | | - | |
237 | | - | |
238 | | - | |
| 239 | + | |
| 240 | + | |
239 | 241 | | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
240 | 255 | | |
241 | 256 | | |
242 | | - | |
| 257 | + | |
243 | 258 | | |
244 | 259 | | |
245 | 260 | | |
| |||
248 | 263 | | |
249 | 264 | | |
250 | 265 | | |
251 | | - | |
| 266 | + | |
252 | 267 | | |
253 | 268 | | |
254 | 269 | | |
255 | | - | |
| 270 | + | |
256 | 271 | | |
257 | 272 | | |
258 | 273 | | |
259 | 274 | | |
260 | | - | |
| 275 | + | |
261 | 276 | | |
262 | 277 | | |
263 | 278 | | |
264 | 279 | | |
265 | 280 | | |
266 | 281 | | |
267 | | - | |
| 282 | + | |
268 | 283 | | |
269 | 284 | | |
270 | 285 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
198 | 198 | | |
199 | 199 | | |
200 | 200 | | |
201 | | - | |
| 201 | + | |
202 | 202 | | |
203 | 203 | | |
204 | 204 | | |
| |||
227 | 227 | | |
228 | 228 | | |
229 | 229 | | |
230 | | - | |
| 230 | + | |
231 | 231 | | |
232 | 232 | | |
233 | 233 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
224 | 224 | | |
225 | 225 | | |
226 | 226 | | |
| 227 | + | |
227 | 228 | | |
228 | 229 | | |
229 | 230 | | |
230 | 231 | | |
231 | 232 | | |
| 233 | + | |
232 | 234 | | |
233 | | - | |
| 235 | + | |
| 236 | + | |
234 | 237 | | |
235 | 238 | | |
236 | 239 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
2 | 7 | | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
| 8 | + | |
26 | 9 | | |
27 | 10 | | |
28 | 11 | | |
29 | 12 | | |
30 | 13 | | |
31 | 14 | | |
32 | 15 | | |
33 | | - | |
| 16 | + | |
34 | 17 | | |
35 | | - | |
| 18 | + | |
36 | 19 | | |
37 | 20 | | |
38 | 21 | | |
39 | 22 | | |
40 | | - | |
| 23 | + | |
41 | 24 | | |
42 | 25 | | |
43 | 26 | | |
| |||
47 | 30 | | |
48 | 31 | | |
49 | 32 | | |
50 | | - | |
| 33 | + | |
51 | 34 | | |
52 | 35 | | |
53 | 36 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
3 | 12 | | |
4 | 13 | | |
5 | 14 | | |
| |||
138 | 147 | | |
139 | 148 | | |
140 | 149 | | |
141 | | - | |
| 150 | + | |
142 | 151 | | |
143 | 152 | | |
144 | 153 | | |
| |||
223 | 232 | | |
224 | 233 | | |
225 | 234 | | |
226 | | - | |
| 235 | + | |
227 | 236 | | |
228 | 237 | | |
229 | 238 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
0 commit comments