Skip to content
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

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

Draft
wants to merge 6 commits into
base: dev
Choose a base branch
from

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?

@@ -107,3 +107,7 @@
<?=$this->recommend($current)?>
<?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.

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