langgenius / langgenius/dify

[Feature] Preserve dataset list filters when navigating back from a dataset detail page

Open
#42,033 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
TypeScript
Stars
156k
Forks
24.6k
Avg merge
22h 9m
Merged PRs (30d)
610

Description

### Self Checks
- [x] I have read the Contributing Guide and Language Policy.
- [x] I have searched for existing issues, including closed ones.
- [x] I confirm that I am using English to submit this report.
- [x] Please do not modify this template and fill in all the required fields.

### 1. Is this request related to a challenge you're experiencing? Tell me about your story.
When I'm on the Knowledge / Datasets list page (`/datasets`), I often filter the list by keyword or tags to find a specific dataset. After entering a dataset detail page and clicking the browser Back button, all filters are reset: the search box is empty and the tag filters are cleared. I have to re-enter the filters every time.

I found that the `view` switcher (legacy/new) is preserved because it is stored in the URL via `useQueryState`, and the Apps list already persists search keywords in the URL via `useQueryStates`. However, the dataset list filters are kept only in local component state and are lost when the list component unmounts on navigation.

### 2. Additional context or comments

Relevant code locations:

- `web/app/components/datasets/list/index.tsx`
- `keywords` and `tagFilterValue` use `useState`
- `includeAll` uses `useBoolean`
- `web/app/components/apps/list.tsx`
- Persists list filters in the URL via `useQueryStates`
- `web/app/components/apps/query-params.ts`
- Uses `nuqs` parsers with debounced URL updates for the keyword input

Suggested fix:
Persist the dataset list filters (`keywords`, `tag_ids`, and `include_all`) in the URL, following the same pattern already used by the Apps list. For example, move these values to `useQueryStates` with `nuqs` parsers and use a debounced URL update for the keyword input. This would make filters survive browser Back navigation, page refresh, and shareable links.

Dify version: `1.17.0`
Deployment: Self Hosted (Docker)

### 3. Can you help us with this feature?
- [x] I am interested in contributing to this feature.

Contributor guide

Open the contributing guide

Research direction

Start in web/app/components/datasets/list/index.tsx, then compare its local filter state with the URL-state pattern in web/app/components/apps/list.tsx and web/app/components/apps/query-params.ts. Persist keywords, tag_ids, and include_all in the dataset URL, and verify that browser Back navigation, refreshes, and shareable links retain the filters.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend, web-dev
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
84/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.