Skip to content

Strategy updates: passive and active #71

@daffl

Description

@daffl

Currently, the smart strategy removes entries when they get deleted and tries to add them to lists (in the right spot) if they match the query.

There are some edge cases that currently are not covered:

  • If the entry is smaller or larger it will get added to the beginning or the end of the list respectively. This might not necessary be the case (e.g. when you $skip and $limit there is no certain way of determining if it is in the list or comes at a position after/before)
  • If an entry gets deleted, it gets removed from reactive lists. If you set $limit they can end up smaller than what you would expect.

If you wanted to cover those edge cases you would use the always strategy which is less than ideal (ultimately I'm not sure it should exist at all).

This is where I think it makes sense to introduce two new list strategies (and remove the smart strategy):

Passive

The passive strategy will update exiting entries in the list (and re-order accordingly) and remove deleted entries but otherwise not modify it (new or updated entries that match the query will not be added).

Active

The active strategy will request a window slightly larger than $limit to be aware of its surrounding entries. That way it will be able to determine for any matching entry where it fits in. If the window gets too small (e.g. because entries were removed from the list) it will re-request a new list.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions