CentreForDigitalHumanities / CentreForDigitalHumanities/readit-interface
Keeping related items up-to-date (30h)
- Dominant language
- TypeScript
- Stars
- 1
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
Currently, when the user edits the related items of an item, she sees an up-to-date overview of the relations with respect to her own "bubble". By this, I mean that the relations completely reflect the relations that existed as of the last time she fetched or saved the item in question and that the items available to reflect the available data as of the moment she first cached items of the appropriate type. **Not** reflected are any items or relations that other users might have added in the meanwhile.
The static (i.e., non-editing) view of the related items is less accurate; it is not even guaranteed to be up-to-date with respect to the user's own bubble. Directly after saving and closing the editor, the changes are never visible in the static view. Closing and reopening the static view may rectify this only partially or not at all. The only reliable way to see the most up-to-date relations is to completely refresh the entire client.
This is problematic for several reasons:
- Not immediately seeing the result of your own changes is confusing and frustrating for the user.
- Duplicate items might be created, as users cannot see each other's changes if they work in parallel.
- Users might accidentally undo each other's changes, as each update of (the relations of) an item completely overwrites the preexisting data associated with said item.
I think the solution consists of a combination of code fixes:
- [ ] The backend should support PATCH in addition to PUT. PATCH requests should only replace the submitted predicates, leaving the other predicates unchanged. The frontend should save updated relations with `{patch: true}`. This mostly prevents undoing other user's changes when updating other items through inverse relations.
- [ ] A `CombinedCollection` should be added to the utilities, which simply contains all the models from zero or more underlying collections and keeps itself up-to-date using event bindings. Special care should be taken with the `'remove'` listener to ensure that models are only removed if they are in none of the underlying collections.
- [ ] The logic that handles the `'cache:items'` request on the `ldChannel`, contained in the `globals/item-cache` module, should be refined:
- [ ] The cache for each type should be a `FilteredCollection` over the global graph, rather than a "fixed" `ItemGraph` as is currently the case.
- [ ] Each cached type should be periodically re-fetched from the server with an `ItemGraph`. I'm thinking about every minute, but maybe the interval can be a bit longer. @alexhebing what do you think about the interval?
- [ ] The `'cache:items'` request should accept an array of types instead of a single type and return a `CombinedCollection` over the `FilteredCollection` caches of all types in the array. For efficiency's sake (i.e., to keep the number of event listeners to a minimum), the cache module should probably reuse a previously created `CombinedCollection` for the same combination of types if available.
- [ ] The handler for the `'cache:inverse-related'` request should periodically re-fetch the requested items, like above.
- [ ] The functions in the `panel-related-items/relation-utilities` module should return collections that continuously keep updating themselves based on event bindings, rather than collections that contend to be complete at some point as is currently the case.
- [x] The static related items panel should become a `CollectionView` (which is inherently self-updating) over its available predicates (which might update if the ontology is not complete yet). Each predicate should be represented by a `RelatedItemsRelationView`, as is currently the case, except that `RelatedItemsRelationView`s are also created for predicates that have no associated relations.
- [x] `RelatedItemsRelationView` should become a `CollectionView` over a `FilteredCollection` over the relations of the predicate represented by the `RelatedItemsRelationView`. As a special case, the view should completely hide itself (using `.$el.hide()` or Bulma's `is-hidden` class) when its collection is empty.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.