Just tell me how to get the id of only one document
The thing is
if delete document is working properly
Why edit won't work
Hey @safwan Can you a take a look here?
sure let me check
@Susmita could you send you updated code? Also please try to enable JS formatting by typing js after the first 3 backticks
I don't have nitro to do that. It exceeds text limit and can't be formatted
okay no worries can you just the send a file or something?
code is uploaded on github
sharing the links here
This is the problem
If you're using conditional rendering, then, you'll always get the last item as this what that item is
pointingto.
To overcome it, you can try different approaches.
- Change from conditional rendering to conditional visibility (with css and classes)
- Use
useRefto create a new pointer for the data.
Here's the link:- https://github.com/Susmita-Dey/ProManager/blob/main/components/Todos.jsx
@Susmita I just looked through your code. One thing I want to ask is if this issue happens even after you close the modal, and reopen it?
For example: You said that when you click the last item, it shows the value of the first item right? What happens when you close that modal and try to edit the last item again?
Another thing is to try @Binyamin's suggestion.
Also, why display the value in the placeholder, when you can use the value attribute in the input?
You can store the value in a state, and use that state in the value attribute. Add an onChange attribute to the input that calls the setState function to update the value seamlessly
Yes
When I click on the first/second item, the last item comes up. After closing the modal and reopening it or reloading the page and then reopening the modal, same thing happens
If I click on the last item, then also the last item comes up which is okay that particular one
And every time I hit update button by clicking on any of the edits, the last items gets updated
Thanks @Binyamin and @safwan
Solved the issue by using a state variable to point the selected item
[SOLVED] Last document getting updated
Recommended threads
- Functions Problem
Whenever I run my AI Generate through Appwrite Functions, I am getting this Call Stack AIService.generateServer (src\services\ai\gemini.ts) next (<native>) ...
- Couldnt not do appwrite push tables
Not sure why i am not able to create my tables
- Frequent 500 Internal Server Errors - Pr...
PROJECT ID: 6951f2xxxxx1ee9e750a REGION: Singapore (sgp.cloud.appwrite.io) PLAN: Pro Our production application experiences **500 Internal Server Errors** mult...