farmOS / field-kit

A modular, offline-first companion app to farmOS.
https://farmOS.org
GNU General Public License v3.0
62 stars 39 forks source link

Add navigation guards on startup routes #486

Open jgaehring opened 2 years ago

jgaehring commented 2 years ago

Because the Vue Router is instantiated before field modules are registered, even when they're cached, opening or reloading any module routes, such as /tasks, can result in a reroute to /home (or /login). I tried to fix this in farmOS/farmOS-client@db5a2af while working on #420, but this doesn't cover dynamic routes, such as /tasks/:id, where the where :id is the UUID of a log.

A separate point to consider, probably worth a separate issue, is whether to continue using UUID's in this context at all, since what used to be a route like /tasks/123 is now /tasks/5798b639-0b44-4e9a-853e-964e49e2bc64.

Regardless, I think there's good reason to improve this behavior to be more robust, perhaps with an in-component navigation guard that has access to the ready state in App.vue, but that might take a little bit of work and careful consideration, and is probably better to address after the migration to Vue 3. It probably doesn't even have to happen for the beta release, but would be a "nice-to-have", so I'm including it in that milestone for now.