-
Notifications
You must be signed in to change notification settings - Fork 194
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
POC: Improve filter behavior when creating new annotations or replies #2434
Conversation
These principles make complete sense.
Maybe client/src/sidebar/util/build-thread.js Line 347 in 4c477b2
client/src/sidebar/services/threads.js Line 20 in 4c477b2
|
I don't think the change you suggested would quite work, as (p.s. Your approach was what I tried first but then ran into the issue I described). (Edited: On third thought, I think I see that the change is perhaps simpler than I'm thinking it is because, as you mention, the contents are only written or "used" in a couple of places. I shall consider!). |
914dc0c
to
39d8784
Compare
Updated to simplify |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From just a behavoir standpoint, I attempted to try various combinations of searching, filtering, editing deleting etc. Everything looks reasonable and works intuitively. This is much better behavoir than what currently exists. I think if the the code changes are substantially small, then I see no reason to not move this forward with haste. 👍
Proper PR here: #2437 |
This draft PR is a POC implementation of some changes to some behavior when creating new annotations or replies when there is one or more applied filter in the client (selected annotations, query filter, or focused-on-a-user). There is some complexity here, so lots of words.
Motivation
The main tenets here is that new annotations (or replies) created while filter (s) is/are applied should:
A ticket was opened (#2324) recently indicating what I believe to be a not-uncommon use case: a user selects an annotation (or annotations) by clicking on highlighted text in the page and then wants to respond to that annotation. Yanking them fully out of the “selected-filter” mode is jarring and confusing. Likewise, performing a search that results in a bunch of excluded replies in a nested thread and then replying to one of the visible results: because this yanks you out of the filter entirely, it has the nasty effect of expanding a bunch of hidden reply threads and confusing the user as to the context of the reply.
In the case of user-focus mode, the situation is, I’d argue, more problematic: if a user who is not the focused-upon-user attempts to reply to one of that user’s annotations, their reply is immediately hidden! That’s bad.
As a result of these changes, creating a new annotation or replying to an annotation when in a filtered mode does not reset filters, and that annotation/reply will stay visible until filters are (eventually) reset.
Other changes here are in support of that behavior.
I’m looking primarily for feedback on the behavior, not the technical implementation, which is messy for the moment.
Out of scope for the moment, but valid needs:
Before and After
When filter query is active
Creating a new annotation
Before:
After:
Creating a reply
Before:
After:
Screenshot of result, after:
When there are selected annotations
Creating an annotation
Before:
After:
Screen shot, after:
Creating a reply
Before:
After:
When user focus mode is active
Creating an annotation
Before:
After:
Creating a reply
Before:
After:
Technical details
Making newly-created annotations and replies reliably show up without resetting filtering entirely involves updating the
forcedVisible
collection in the selection store instead of usingclearSelection
on annotation/reply creation, and making sure thatforcedVisible
annotations are respected and presented in the proper contexts (forcedVisible
collections are reset upon clearing selections/filters).Some wrinkles:
$tag
property but do not yet have anid
. This$tag
needs to be added to theforcedVisible
collection initially to assure the new annotation/reply remains visible, but after save, that entry needs to be updated to use the server-assignedid
such that it matches to a realthread
in therootThread
. If this sounds odd (i.e. “can’t we use$tag
orid
interchangeably here?”) it’s a little complex to explain the “no” answer in short summary, but I’m happy to elaborate, preferably with voices. These changes implement this updating from$tag
->$id
in the selection module (hastily, without elegance; I’ll refactor).REMOVE_ANNOTATIONS
. It has been correctly removing removed annotation ids from the set ofselected
annotations, but had not been removing references to removed annotations fromforcedVisible
andexpanded
. This was essentially a bug, but didn’t manifest until some of the other changes on this branch happened.FilterStatus
really needs to be refactored into multiple components. It’s getting too brittle and complex. There will be some duplicated logic, likely, between those components, but, eh.FilterStatus
component. And it also highlights the difference between how we count “annotations” in different modes (not a new problem). In non-filtered modes and when there are selected annotations, only top-level annotations are “counted”: the counts next to tabs and in the “show all” button when viewing selected annotations exclude replies. Counts when filtering by query or user, however, include both annotations and replies. I’ve been trying to manage juggling this as best I can to this point…Next Steps
FilterStatus