Skip to content

feat(pagination): implement pagination using context

Olivier Goulet requested to merge oliviergoulet/main/15-collection into main

Resolves #15 (closed)

The approach is slightly different to !11 (closed)

Instead of adding event listeners to window, this will instead use an "orchestrating" component (efsc-collection) to catch events (via Lit Context, which uses events under the hood).

The usage is as follows:

<efsc-collection> <!-- provides Pagination context -->
  <efsc-members-list></efsc-members-list> <!-- consumes Pagination context, fetches data & updates totalPages -->
  <efsc-pagination></efsc-pagination> <!-- consumes Pagination context, updates currentPage -->
</efsc-collection>

Hopefully, efsc-collection can be used in the future for more than just pagination. I envision it also holding filter and search contexts.

Edited by Olivier Goulet

Merge request reports

Loading