Skip to content

feat: add Load All button to fetch all data at once#23

Draft
cristinecula wants to merge 8 commits intomainfrom
feature/neo-926-add-a-load-all-button-to-fetch-all-data-to-browser
Draft

feat: add Load All button to fetch all data at once#23
cristinecula wants to merge 8 commits intomainfrom
feature/neo-926-add-a-load-all-button-to-fetch-all-data-to-browser

Conversation

@cristinecula
Copy link
Contributor

Summary

Implements NEO-926: Add a "Load All" button alongside the existing "Load More" button to fetch all available data in one request.

Changes

  • src/list/more/use-more.ts: Add loadAll function that fetches all data at once by requesting pageSize: totalAvailable
  • src/list/more/render-more.ts: Add "Load All" button with onAll prop, deprecate loading prop in favor of data$
  • src/list/use-list-core.ts: Pass through loadAll in return value
  • src/list/render-list-core.ts: Wire up loadAll to renderLoadMore
  • .storybook/preview.js: Setup i18next for Storybook environment
  • stories/load-more.stories.ts: Add stories demonstrating both buttons

Behavior

State "Load more" "Load all"
More data exists Visible Visible
Fetching in progress Spinner Spinner
All data loaded Hidden Hidden

Testing

  • All 45 tests pass
  • New stories verify button visibility, click interactions, and loading states

Notes

  • Builds on top of NEO-927 (Vitest migration)
  • loadAll replaces data instead of accumulating (re-fetches from beginning with scroll API)

Closes NEO-926

- Replace WTR with Vitest for test infrastructure
- Add dual project setup: unit tests (jsdom) and storybook tests (browser)
- Migrate unit tests (fetch, path) to Vitest syntax with vi.* mocks
- Convert UI tests (render, item-click, use-pref) to Storybook interaction tests
- Add @storybook/addon-vitest integration for browser-based testing
- Update package.json scripts: test, test:unit, test:storybook, test:watch

NEO-927
- Add @types/react for Storybook type definitions
- Add skipLibCheck to tsconfig.json for Storybook type compatibility
- Fix unused 'within' import in render.stories.ts
- Fix window type casts in use-pref.stories.ts
- Create stories/helpers/render-hook.ts utility for testing Pion hooks
- Use Storybook args pattern in render.stories.ts instead of window globals
- Simplify use-pref.stories.ts using renderHook utility
- Remove all window global usage from story tests
Replace local stories/helpers/render-hook.ts with @Neovici/testing@2.2.0
which now provides the same renderHook functionality for Pion hooks.
- Add HTML snapshots to RenderNavTest, RenderNavWithCallbacks, and RenderPaginationTest
- Use vitest expect for snapshot assertions (storybook/test uses Chai which lacks snapshot support)
- Snapshots capture DOM structure before user interactions
@github-actions
Copy link

github-actions bot commented Feb 7, 2026

PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://Neovici.github.io/cosmoz-queue/pr/pr-23/

Built to branch gh-pages at 2026-02-07 01:18 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@cristinecula cristinecula self-assigned this Feb 7, 2026
Move snapshot assertions out of story play functions to avoid
vitest expect being bundled into the deployed Storybook UI,
which caused 'Cannot read properties of undefined' errors.

The interaction tests remain and provide sufficient coverage.
- Add loadAll function to use-more.ts that fetches all available data
- Add Load All button to render-more.ts with onAll prop
- Deprecate loading prop in favor of data$ for loading state
- Wire up loadAll through use-list-core.ts and render-list-core.ts
- Setup i18next in Storybook environment for translations
- Add stories demonstrating Load More and Load All functionality
- Update snapshots with translated button titles
@cristinecula cristinecula force-pushed the feature/neo-926-add-a-load-all-button-to-fetch-all-data-to-browser branch from 910d8c7 to 9241c1d Compare February 7, 2026 01:18
Base automatically changed from feature/neo-927-migrate-cosmoz-queue-tests-from-wtr-to-vitest to main February 9, 2026 07:18
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.

1 participant