plainblack / TGCv

TGC built on ving instead of wing
https://plainblack.github.io/ving/
0 stars 0 forks source link

Find out why disposing HardwareTasks breaks navigation #6

Open perlDreamer opened 1 week ago

perlDreamer commented 1 week ago

Currently commented out on HardwareTickets and HardwareSchedule

perlDreamer commented 1 week ago

Added console logging after every step of useVingRecord:dispose, everything logged. Added console logging in maintenanceticket:index.mjs inside onBeforeRouteLeave, it starts but never finishes. No errors are thrown.

useVingKind dispose iterates over records, calling dispose on each of them. For Tasks, there are 242 records that need to be disposed, but it silently dies when trying to call dispose on task 71. That's probably on the call to this.$reset. I wrapped it in a try/catch block and this is that it spews:

Screenshot 2024-09-09 at 12 55 29 PM

Not sure why this isn't being normally logged? But it lets everything finish.

perlDreamer commented 1 week ago

More information.

There are 242 records in the database. The page says that there are 242 records to be cleaned up. But Record 67 and 75 both seem to have the same Pinia id HardwareTaskvEHd5pX. I bet you can't safely call $reset on an object twice in Pinia.

Record 67
useVingRecord.mjs:201 HardwareTaskvEHd5pX
useVingKind.mjs:226 Record 68
useVingRecord.mjs:201 HardwareTaskvDfbKKX
useVingKind.mjs:226 Record 69
useVingRecord.mjs:201 HardwareTaskvETONuq
useVingKind.mjs:226 Record 70
useVingRecord.mjs:201 HardwareTaskvBdZOsQ
useVingKind.mjs:226 Record 71
useVingRecord.mjs:198 TypeError: Cannot convert undefined or null to object
    at assign (<anonymous>)
    at pinia.mjs:1336:17
    at Proxy.$patch (pinia.mjs:1304:13)
    at Proxy.$reset2 (pinia.mjs:1335:18)
    at Proxy.dispose (useVingRecord.mjs:197:28)
    at Proxy.<anonymous> (pinia.mjs:1380:30)
    at store.<computed> (pinia.mjs:935:50)
    at VingKind.dispose (useVingKind.mjs:228:20)
    at index.vue:156:22
    at vue-router.mjs:2066:56
useVingRecord.mjs:201 HardwareTaskvEHd5pX
perlDreamer commented 1 week ago

In the 242 records, that's the only duplicated record. I don't have an easy way to get all the records from the db to figure out which one is duplicated.