Skip to content

[VUFIND-1674] Show count of saved items in account menu#3836

Draft
demiankatz wants to merge 6 commits intovufind-org:devfrom
demiankatz:vufind-1674
Draft

[VUFIND-1674] Show count of saved items in account menu#3836
demiankatz wants to merge 6 commits intovufind-org:devfrom
demiankatz:vufind-1674

Conversation

@demiankatz
Copy link
Member

@demiankatz demiankatz commented Jul 25, 2024

This is an initial proof of concept.

TODO

  • Invalidate the cache when records are added/removed
  • Discuss implementation points highlighted below
  • Add tests
  • Resolve VUFIND-1674 when merging

@demiankatz demiankatz added this to the 10.1 milestone Jul 25, 2024
@demiankatz demiankatz marked this pull request as draft July 25, 2024 17:10
public function handleRequest(Params $params)
{
$this->disableSessionWrites(); // avoid session write timing bug
$count = $this->user ? count($this->resourceService->getFavorites($this->user)) : 0;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it worth creating a new resourceService method that just returns a count to reduce the amount of data pushed around, or is it better to keep this simple and trust the caching?

<?php endforeach; ?>
</div>

<?php if (!isset($list)): ?>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right now, the cache only gets invalidated when you go to the favorites page. Maybe it would be better to always invalidate the cache on all list pages, so that list actions cause the favorites total to get recalculated. However, this would make a lot of unnecessary requests or would require the addition of some additional logic to figure out when invalidation is really needed.

@demiankatz
Copy link
Member Author

This needs more time to mature, so I am moving it to the 11.0 milestone.

@demiankatz
Copy link
Member Author

Reassigning milestone as per discussion on the 1 July Community Call.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant