Commit 4754972
committed
Fix custom unit ID mismatch when duplicating workspace
When duplicating a workspace, getCustomUnitsForDuplication() copied the
source workspace's CustomUnit objects verbatim under new dictionary keys.
This left the internal customUnitID and rate customUnitRateID properties
pointing to the old workspace's IDs, creating a mismatch between the
dictionary key and the object's own ID.
When a user then created a distance manual expense in the duplicate
workspace, the transaction was sent to the backend with the old
customUnitID/customUnitRateID, which don't exist on the new workspace,
causing an "Unexpected error" API failure.
The fix clones each CustomUnit with updated customUnitID and regenerated
rate IDs so the optimistic data is internally consistent.1 parent 1dd01da commit 4754972
1 file changed
Lines changed: 23 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| 52 | + | |
52 | 53 | | |
53 | 54 | | |
54 | 55 | | |
| |||
307 | 308 | | |
308 | 309 | | |
309 | 310 | | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
310 | 327 | | |
311 | 328 | | |
312 | 329 | | |
| |||
331 | 348 | | |
332 | 349 | | |
333 | 350 | | |
334 | | - | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
335 | 355 | | |
336 | 356 | | |
337 | 357 | | |
338 | 358 | | |
339 | 359 | | |
340 | 360 | | |
341 | 361 | | |
342 | | - | |
| 362 | + | |
343 | 363 | | |
344 | 364 | | |
345 | 365 | | |
346 | 366 | | |
347 | 367 | | |
348 | 368 | | |
349 | | - | |
| 369 | + | |
350 | 370 | | |
351 | 371 | | |
352 | 372 | | |
| |||
0 commit comments