[inspect] Use new stack-based view mode #880
Merged
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.
After using the new view-mode functionality locally for some time, I concluded that in 99% of cases you only want to toggle
:object
view mode for the currently inspected value. When you subsequently click on one of the fields to inspect further, you'd rather see the normal view mode again. So, in my experience, it looked likev
, click the field with usually a recognizable data structure,v
again to toggle back to normal view mode.I propose to make this behavior the default one. When the user navigates away from the current view, the view-mode will reset. For that, I've introduced a concept of "transient config values".
In this PR, any action other than
toggle-view-mode
will reset the view-mode back to:normal
. Now that I think of it, some actions make sense to preserve the view mode, e.g.next-prev/sibling
(if you are viewing the value in:object
view, it's likely you want to see its sibling in that view too).prev/next
page don't make sense for object view, so it's whatever there. So, perhaps, the resetting logic should only exist fordown/up
ops. Maybe maintain it as another stack (this will be neat but require the most work)?WDYT?
EDIT
It was decided to implement :view-mode switching on the Orchard side and keep a stack of modes for the history of inspected values. That way, when the user downs to another value, the :view-mode is reset to :normal. When they go back up, the :view-mode is restored from the stack.