Skip to content

Conversation

@yomybaby
Copy link
Member

@yomybaby yomybaby commented Nov 16, 2025

Resolves #4645 (FR-1683)

Background

Currently, the React application uses use-query-params for URL state management. However, this library has limitations when working with React's newer concurrent features, particularly React Transitions. As a result, users may experience delayed feedback when interacting with URL-driven state changes.

Purpose

Modernize URL state management by adopting nuqs, which is specifically designed to handle React Transitions effectively. This will provide:

  • Faster user feedback: Immediate visual responses during state transitions
  • Better React Transition support: Seamless integration with React's concurrent rendering
  • Improved user experience: More responsive UI with optimistic updates and proper loading states

Key Changes

  • Migrated from use-query-params to nuqs across all React components
  • Replaced QueryParamProvider with NuqsAdapter in providers
  • Updated pagination hooks to use nuqs API (useQueryStates, parseAsInteger)
  • Created new helper utilities for GraphQL Result type handling
  • Maintained type safety with proper TypeScript types and zod schemas
  • Added legacy hooks for backward compatibility during migration

Expected Outcomes

  • Users see immediate visual feedback when changing filters, tabs, or pagination
  • Smoother transitions between different views and states
  • URL state changes feel more responsive and aligned with modern web application standards
  • Better integration with React's concurrent features for future optimizations

Checklist:

  • Documentation
  • Minimum required manager version
  • Specific setting for review
  • Minimum requirements to check during review
  • Test case(s) to demonstrate the difference of before/after
    • Test URL state changes in session list page (filters, pagination, tabs)
    • Verify React Transitions feel more responsive
    • Check browser history navigation works correctly

@github-actions github-actions bot added area:ux UI / UX issue. area:i18n Localization size:XL 500~ LoC labels Nov 16, 2025
Copy link
Member Author

yomybaby commented Nov 16, 2025


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • flow:merge-queue - adds this PR to the back of the merge queue
  • flow:hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has required the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@yomybaby yomybaby force-pushed the feat/FR-1683-migrate-url-state-to-nuqs branch from c3fe32d to e8a4030 Compare November 16, 2025 22:45
@github-actions
Copy link

github-actions bot commented Nov 16, 2025

Coverage report for ./react

St.
Category Percentage Covered / Total
🔴 Statements 4.7% 548/11648
🔴 Branches 3.81% 314/8238
🔴 Functions 2.91% 104/3570
🔴 Lines 4.65% 530/11391

Test suite run success

125 tests passing in 14 suites.

Report generated by 🧪jest coverage report action from e9ef843

@yomybaby yomybaby force-pushed the feat/FR-1683-migrate-url-state-to-nuqs branch from e8a4030 to fc160a3 Compare November 17, 2025 05:33
@yomybaby yomybaby marked this pull request as ready for review November 17, 2025 06:22
Copilot AI review requested due to automatic review settings November 17, 2025 06:22
Copilot finished reviewing on behalf of yomybaby November 17, 2025 06:23
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR migrates URL state management from use-query-params to nuqs for improved React Transition support. The migration is progressive: ComputeSessionListPage adopts the new nuqs library, while other components temporarily use a legacy hook (useBAIPaginationOptionStateOnSearchParamLegacy) to maintain existing functionality.

Key Changes:

  • Integrated nuqs library with NuqsAdapter wrapper in the App component
  • Migrated ComputeSessionListPage to use nuqs with type-safe query parameter parsing
  • Added GraphQL @catch directive for error handling with new Result type utilities
  • Updated test infrastructure (Jest 30, related dependencies) to support the migration

Reviewed Changes

Copilot reviewed 42 out of 43 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
react/src/pages/ComputeSessionListPage.tsx Primary migration to nuqs with parseAsStringLiteral for type safety, added @catch error handling
react/src/hooks/reactPaginationQueryOptions.tsx Created new nuqs-based hook and renamed old hook to "Legacy"
react/src/helper/resultTypes.ts Added utility types and functions for GraphQL Result type handling
react/src/App.tsx Wrapped app with NuqsAdapter for react-router v6 integration
react/src/components/SessionNodes.tsx Exported sorter values array for type checking, improved sorter configuration
react/src/RelayEnvironment.ts Added rawErrorMessage extraction for Relay 18.1.0+ compatibility
react/package.json Added nuqs (2.7.3) and zod (4.1.12) dependencies, updated Jest dependencies
react/jest.config.js Updated transformIgnorePatterns to include nuqs package
resources/i18n/*.json Added "FailedToLoadTableData" error message across all 20 languages
Various component files Migrated to legacy pagination hook to maintain compatibility during transition
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

Copy link
Contributor

@agatha197 agatha197 left a comment

Choose a reason for hiding this comment

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

Please apply reviews. Except for them, it works fine.

@yomybaby yomybaby force-pushed the feat/FR-1683-migrate-url-state-to-nuqs branch 2 times, most recently from c53a420 to 097a609 Compare November 18, 2025 09:24
@yomybaby yomybaby requested a review from nowgnuesLee November 18, 2025 09:24
Copy link
Contributor

@nowgnuesLee nowgnuesLee left a comment

Choose a reason for hiding this comment

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

LGTM

@graphite-app
Copy link

graphite-app bot commented Nov 19, 2025

Merge activity

…nuqs for better React Transition support (#4646)

Resolves #4645 ([FR-1683](https://lablup.atlassian.net/browse/FR-1683))

## Background

Currently, the React application uses `use-query-params` for URL state management. However, this library has limitations when working with React's newer concurrent features, particularly React Transitions. As a result, users may experience delayed feedback when interacting with URL-driven state changes.

## Purpose

Modernize URL state management by adopting `nuqs`, which is specifically designed to handle React Transitions effectively. This will provide:

* **Faster user feedback**: Immediate visual responses during state transitions
* **Better React Transition support**: Seamless integration with React's concurrent rendering
* **Improved user experience**: More responsive UI with optimistic updates and proper loading states

## Key Changes

* Migrated from `use-query-params` to `nuqs` across all React components
* Replaced `QueryParamProvider` with `NuqsAdapter` in providers
* Updated pagination hooks to use `nuqs` API (`useQueryStates`, `parseAsInteger`)
* Created new helper utilities for GraphQL Result type handling
* Maintained type safety with proper TypeScript types and zod schemas
* Added legacy hooks for backward compatibility during migration

## Expected Outcomes

* Users see immediate visual feedback when changing filters, tabs, or pagination
* Smoother transitions between different views and states
* URL state changes feel more responsive and aligned with modern web application standards
* Better integration with React's concurrent features for future optimizations

**Checklist:**

- [ ] Documentation
- [ ] Minimum required manager version
- [ ] Specific setting for review
- [ ] Minimum requirements to check during review
- [x] Test case(s) to demonstrate the difference of before/after
  - Test URL state changes in session list page (filters, pagination, tabs)
  - Verify React Transitions feel more responsive
  - Check browser history navigation works correctly

[FR-1683]: https://lablup.atlassian.net/browse/FR-1683?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
@graphite-app graphite-app bot force-pushed the feat/FR-1683-migrate-url-state-to-nuqs branch from 097a609 to e9ef843 Compare November 19, 2025 01:56
@graphite-app graphite-app bot merged commit e9ef843 into main Nov 19, 2025
11 checks passed
@graphite-app graphite-app bot deleted the feat/FR-1683-migrate-url-state-to-nuqs branch November 19, 2025 01:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:i18n Localization area:ux UI / UX issue. size:XL 500~ LoC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate from use-query-params to nuqs library for URL state management

4 participants