-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: Item disappears after editing 🐞 #418
Comments
It seems that this line is returning the incomplete list. Lines 217 to 218 in b8aee0e
|
Turns out this empty item is created on mvp/lib/app_web/live/app_live.ex Line 31 in b8aee0e
def get_draft_item(person_id) do
Repo.get_by(Item, status: 7, person_id: person_id) ||
Repo.insert!(%Item{person_id: person_id, status: 7})
end Maybe this is intended or not but I feel like I'm digressing ☠️ |
I think I found the reason why the item disappears after being edited. It's because after being edited, its Can't figure why it's properly appended if I refresh the page though :( |
Ok, I think I understand it now, but I have a few questions. Why is this failing?Every time an item is updated, Lines 165 to 169 in b8aee0e
Which, in turn, calls Lines 25 to 30 in b8aee0e
What's missing here is, inside Why does the item show after refreshing the page?Simple. Because, on mvp/lib/app_web/live/app_live.ex Lines 18 to 31 in b8aee0e
OK, so just update the list
|
@LuchoTurtle Thanks for opening this issue. 📥 The reason for this issue is simple: the Lines 122 to 126 in 68f5562
Which invokes changeset/2 :Lines 25 to 30 in da1cc04
specifically the line: Line 29 in da1cc04
which invokes: https://github.com/dwyl/mvp/blob/da1cc04d74f670e69e4ba58eebfc71a24fc523ec/lib/app/cid.ex#L10C7-L24 The problem is: when the To resolve this issue is very easy. # Update an item without changing the cid ref: #418
def changeset_update(item, attrs) do
item
|> cast(attrs, [:cid, :person_id, :status, :text])
|> validate_required([:cid, :text, :person_id])
end Already fixed by: Lines 43 to 48 in 8acf8c0
Included in the PR I'm updating: #165 🧑💻 ⏳ P.S: "opinions" never. Only logic. The logic in this was bad for the long-term of |
I don't know if this is strictly related to #417 but I've noticed that if I edit an item, after saving it, the item disappears.
Check the video below.
Screen.Recording.2023-09-09.at.01.53.12.mov
After refreshing, the edited item is shown normally.
The text was updated successfully, but these errors were encountered: