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
pointing
to.
To overcome it, you can try different approaches.
- Change from conditional rendering to conditional visibility (with css and classes)
- Use
useRef
to 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
- Need help with createExecution function
Hi, Need some help understanding createExecution. When requesting function execution via createExecution, the function handler arguments are incorrect and rese...
- Query Appwrite
Hello, I have a question regarding Queries in Appwrite. If I have a string "YYYY-MM", how can I query the $createdAt column to match this filter?
- Need Help with Google OAuth2 in Expo usi...
I'm learning React Native with Expo and trying to set up Google OAuth2 with Appwrite. I couldn't find any good docs or tutorials for this and my own attempt did...