79216872

Date: 2024-11-22 23:57:56
Score: 1
Natty:
Report link

Simple way to know if loading vs not found in Vue:

const item = useObservable(Dexie.liveQuery(() => db.items.get(id.value).then(o => o || null)))

// Handle not found (undefined = still loading, null = not found)
watch(item, (newItem) => {
  if (newItem === null) {
    // HANDLE NOT FOUND
  }
})
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Peter Coppinger