Skip to content
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

Error on submit when removing the last item from a nested resource #21

Closed
totaltrash opened this issue Jul 20, 2021 · 1 comment
Closed
Labels
bug Something isn't working

Comments

@totaltrash
Copy link
Contributor

See test case in #20

C&P from discord:

whenever we remove a form, we just track the path we're removing e.g

%Form{
  removed_paths: [
    [:comments, 0, :post],
    [:post, :comments, 0]
  ]
}

and then when we create a form we just traverse all the forms and their data and remove those things
Yeah, thats what we'll have to do

dblack — Today at 16:19

uh, say i remove a form, then add a form, then remove a form... will that all fall over as the new form might get blown away on validate by the list of removed_paths.

ZachDaniel — Today at 16:19

No, that should be fine

dblack — Today at 16:20

cool

ZachDaniel — Today at 16:20

because when we handle these removed_paths, we're only going to remove the data that backs them
like if you had data like post: [comment, comment, comment]
if you remove [:post, :comments, 0] we also get the data for that form, and remove the 0th thing
and thats effectively "permanent"

@totaltrash totaltrash added the bug Something isn't working label Jul 20, 2021
@zachdaniel
Copy link
Contributor

Fixed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants