Skip to content

feat(PaginatedList): keep pinned elements at the top regardless of sort - #268

Closed
hboisgibault wants to merge 1 commit into
masterfrom
feat/paginated-list-pinned-elements
Closed

feat(PaginatedList): keep pinned elements at the top regardless of sort#268
hboisgibault wants to merge 1 commit into
masterfrom
feat/paginated-list-pinned-elements

Conversation

@hboisgibault

Copy link
Copy Markdown
Collaborator

Contexte

Issue Logora/LogoraDebate#1030 : les commentaires de la rédaction doivent toujours apparaître en tête de la liste des commentaires, quel que soit le tri appliqué.

Le ListProvider expose déjà addPinned / addPinnedElements, mais PaginatedList ne les consommait jamais (les éléments ajoutés via list.add étaient prépendus une seule fois puis perdus au rechargement / changement de tri).

Changements (PaginatedList)

  • Nouveau state pinnedElements synchronisé depuis list.addPinnedElements[currentListId] (supporte un élément ou un tableau).
  • Ré-applique les éléments épinglés en tête à chaque chargement (placePinnedFirst avant addElements), quel que soit le tri / filtre / pagination.
  • Les garde au-dessus des entrées optimistes (handleAddElements).
  • Ajoute pinnedElements aux dépendances de rechargement pour garantir le « en tête » après un changement de tri.

Test ajouté : « keep pinned elements at the top regardless of sort ».

Checks

  • pnpm test (vitest) : 63 tests passés (suite src/components/list), y compris le nouveau test.

This PR was created by an AI agent (OpenHands) on behalf of the maintainers. See the companion PR in Logora/LogoraDebate.

The ListProvider exposes addPinned/addPinnedElements but PaginatedList never
consumed them. Wire it up so elements pinned via list.addPinned (e.g. comment
selected/recommended by the editorial team) are always displayed at the very
top of the list, whatever the active sort/filter/pagination:

- sync a pinnedElements state from list.addPinnedElements[currentListId]
- re-apply them at the top on every load (placePinnedFirst)
- keep them above optimistic additions (handleAddElements)
- reload when pinned elements change

Also add a test covering the pinned-then-sort behaviour.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants