Chapters
00:00 - Difficulties Controller Index Route Handler
03:36 - Defining our Difficulty Index Route
04:12 - Creating the Difficulty List Page
09:46 - Viewing our List Page
10:16 - Adding a Color Hex Input to our FormInput Component
12:00 - Storing New Difficulties
14:50 - Testing our Add Difficulty Flow
Join The Discussion! (4 Comments)
Please sign in or sign up for free to join in on the dicussion.
usources
Hii, there is a bug, clicking on 'next lesson' redirects to 'refreshing partital page' data instend of 7.1
Please sign in or sign up for free to reply
tomgobich
Hi usources! Apologies about that, and thanks so much for letting me know! Should be fixed up now! 😊
Please sign in or sign up for free to reply
martin-cervantes
I'm creating a similar project. I have a controller for users.
async show({ inertia }: HttpContext) { const users = await this.userService.getUsers() const serializedUsers = users.map((user) => user.serialize()) return inertia.render('usuarios', { users: serializedUsers }) }
async destroy({ params, response }: HttpContext) { await this.userService.delete(params.id) return response.redirect().toRoute('users.show') }
When I call router.delete(`/users/${id}`) from the view, everything seems to work fine. If I check Fetch/XHR in the browser, I get the DELETE and the new GET of users with the data updated correctly, but the deleted user is still visible in the view. Any idea what the problem might be?
Please sign in or sign up for free to reply
tomgobich
Hi Martin!
Sounds like it is most likely a reactivity issue. When the redirect occurs, Inertia will use the new data to update the props of the page. If the reactivity from the props is severed, then that would cause those props and your view to become out of sync.
You should be able to use Vue Devtools to inspect and verify that the props are actually getting updated. Then, follow your usage of that prop to see exactly where the reactivity is being severed.
You could also do a simplified sanity check to ensure that the flow is indeed working.
Please sign in or sign up for free to reply