Repository navigation
Solve the spooky empty field issue - #365
Open
jgonggrijp wants to merge 10 commits into
Open
jgonggrijp wants to merge 10 commits into
jgonggrijp wants to merge 10 commits into
Conversation
No idea why I didn't run into this before.
This commit is meant to be cherry-picked when needed (during testing and debugging) and reverted when no longer needed.
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.
This addresses #363. The issue emerged when the original record had a field with an empty string value. There were two places in the frontend code where a wrong branch was taken because a truthyness check was performed instead of a nullishness check. I also added some hacks so that "empty" values are recognizable as such for the user.
This was a good debugging lesson for myself. I needed the debugger and regression tests and manual functional testing to get a complete picture of what was going wrong; with only one or two of those ingredients, I would not have been able to fix it.
Empty string value with correction and deletion, before the fix:
Empty string value with correction, after the fix:
Empty string value with deletion, after the fix:
I also remembered to take care of the dangling edit relink picker:
If you want to play around with it, #363 details how to find a record with this problem. I have cherry-picked the commit with the shift-click hack that lets you simulate dangling edits. I will revert that again before merging.
I have not addressed the more profound questions:
Those might deserve a discussion, but I figured the frontend should have a meaningful way to display and manipulate empty strings, anyway.