Fix dropping readonly fields from Change#1780
Open
kepi wants to merge 1 commit intonaymspace:developfrom
Open
Conversation
When experimenting with AshBackpex, I found out that :readonly fields aren't correctly dropped from a Change. As I have :update action which accepts only some of fields, I need this working. Only alternative would be to omit read only fields from edit form which doesn't suit my use case. I also added simple tests for this, but as there is currently no LiveView test infrastructure, I used dirty workaround and copied private drop_readonly_changes function directly to tests for now so I can see if it works.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When experimenting with AshBackpex, I found out that :readonly fields aren't correctly dropped from a Change.
As I have :update action which accepts only some of fields, I need this working. Only alternative would be to omit read only fields from edit form which doesn't suit my use case.
I also added simple tests for this, but I don't really know how to test this correctly with existing tests structure. For now, I used dirty workaround and copied private
drop_readonly_changesfunction directly to tests, just so I can test if it works.But I think better (not ideal) way would be making the
drop_readonly_changesnon-private and add@doc false. Are you OK with that? Ideal would be probably to setup some "infrastructure" for LiveView and check whole process, but I'm not even sure where to begin with that.