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

Fix: Cannot return multi in handle create #51

Merged

Conversation

alexandreaco
Copy link

  • Multis returned from handle_create/2 were being caught by the guard on line 129. Teal cannot preload the resource because it doesn’t know what key is associated with the resource update within the multi. A 500 error was being thrown when Teal attempted to preload the full map returned from the multi.
  • Updates guard clauses so changeset models are caught on line 129 and successful multi responses are caught on 134 and passed to the application’s resource file’s render_create override
  • Updates the function definitions with _cs and _multi to better describe the flow

- Multis returned from handle_create/2 were being caught by the guard on line 129. Teal cannot preload the resource because it doesn’t know what key is associated with the resource update within the multi. A 500 error was being thrown when Teal attempted to preload the full map returned from the multi.
- Updates guard clauses so changeset models are caught on line 129 and successful multi responses are caught on 134 and passed to the application’s resource file’s render_create override
- Updates the function definitions with _cs and _multi to better describe the flow
@alexandreaco alexandreaco force-pushed the alex/fix-cannot-return-multi-in-handle-create-bug branch from aeb3d05 to 417b949 Compare January 27, 2021 20:31
Copy link
Contributor

@staylorwr staylorwr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It took me a minute to parse the changes, but these look good to me. I sure wish that the result of a Repo.transaction(multi) had a different success response structure rather then the {:ok, changes}.

Thanks Alex! Merge when you're ready and I'll cut a new release.

@alexandreaco alexandreaco merged commit 7aaabf1 into master Feb 3, 2021
@alexandreaco alexandreaco deleted the alex/fix-cannot-return-multi-in-handle-create-bug branch February 3, 2021 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants