Skip to content

dbeaver/pro#7562 [CB] keep data editor filter state during session#4261

Open
SychevAndrey wants to merge 28 commits intodevelfrom
7562-cb-keep-data-editor-filter-state-during-session
Open

dbeaver/pro#7562 [CB] keep data editor filter state during session#4261
SychevAndrey wants to merge 28 commits intodevelfrom
7562-cb-keep-data-editor-filter-state-during-session

Conversation

@SychevAndrey
Copy link
Copy Markdown
Contributor

No description provided.

SychevAndrey and others added 25 commits March 24, 2026 17:33
replaced private restorePendingState()  with public restoreViewState(pinnedColumnNames, columnOrderNames?) that takes data directly as arguments
bug with skipping constraints if any without a position.
if (!prevColumn) {
        return;
      }
…of github.com:dbeaver/cloudbeaver into 7562-cb-keep-data-editor-filter-state-after-reconnect
…LDataFilter"

This reverts commit 3e0e86f.

Last test showed that we don't need any additional logic on BE. It handles all constraints properly.
@codacy-production
Copy link
Copy Markdown

codacy-production bot commented Apr 3, 2026

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 4 complexity

Metric Results
Complexity 4

View in Codacy

TIP This summary will be updated as you push new changes. Give us feedback

{
static dataFormat: ResultDataFormat[] | null = null;

private store: Record<string, unknown> = {};
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

please initialize it in the constructor and make it observable.ref

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Seems like Its still not in the constructor

…e level, simplify persisted state sync

- Make DatabasePersistedStateAction a standalone class on DatabaseDataSource instead of per-result action
- Convert options to getter
- Auto-sync constraints to persisted state via autorun + action batching
- Restore view state (pinned columns, column order) in GridViewAction constructor
{
static dataFormat: ResultDataFormat[] | null = null;

private store: Record<string, unknown> = {};
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Seems like Its still not in the constructor

try {
const persistedState = pageState?.persistedState;

if (persistedState && validatePersistedState(persistedState) && model.source.options) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What should throw here? validatePersistedState uses .safeParse which does not throw

@SychevAndrey SychevAndrey requested review from Wroud and devnaumov April 10, 2026 12:10
import type { IDatabasePersistedStateAction } from '../IDatabasePersistedStateAction.js';
import { validatePersistedState } from '../../../DataViewerTableState/validatePersistedState.js';

export class DatabasePersistedStateAction implements IDatabasePersistedStateAction {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

please change it's name because it's not an action anymore

Comment on lines +18 to +23
export const PERSISTED_STATE_KEY = {
constraints: 'constraints',
whereFilter: 'whereFilter',
pinnedColumns: 'pinnedColumns',
columnOrder: 'columnOrder',
} as Record<keyof IDataViewerPersistedState, string>;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this is usually is a private implementation of the action and not exported constants, please keep it private inside actions

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.

3 participants