Skip to content

fix: tables columns reset to default#2216

Open
nitrosx wants to merge 2 commits intomasterfrom
swap-5252-tables-reset
Open

fix: tables columns reset to default#2216
nitrosx wants to merge 2 commits intomasterfrom
swap-5252-tables-reset

Conversation

@nitrosx
Copy link
Member

@nitrosx nitrosx commented Feb 6, 2026

Description

This PR enables the user to reload the default settings for datasets and proposals list tables, by selecting table settings menu -> default settings.
Once the default setting option is selected, the table columns will revert back to the defaults configured by the site admin and also the user settings are updated to contain the defaults.

Motivation

This PR is motivated by a better UX and to allow users to revert back to the default view configured by the site admin based to facility policies and to better show the data

Changes:

Please provide a list of the changes implemented by this PR

  • Datasets list component
  • Proposal list component

Tests included

  • Included for each change/fix?
  • Passing? (Merge will not be approved unless this is checked)

Documentation

  • swagger documentation updated [required]
  • official documentation updated [nice-to-have]

official documentation info

If you have updated the official documentation, please provide PR # and URL of the pages where the updates are included

Backend version

  • Does it require a specific version of the backend
  • which version of the backend is required:

Summary by Sourcery

Enable table columns in proposal and dataset lists to be reset to admin-defined defaults and persist those defaults to user settings.

New Features:

  • Allow resetting proposal table column configuration to default settings defined in application configuration.
  • Allow resetting dataset table column configuration to default settings defined in application configuration.

Enhancements:

  • Align table settings handling in proposal and dataset tables to distinguish between default configuration and user-specific column settings.

@nitrosx nitrosx requested a review from Junjiequan February 6, 2026 13:05
@nitrosx nitrosx requested a review from a team as a code owner February 6, 2026 13:05
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - I've found 1 issue, and left some high level feedback:

  • In both proposal and dataset tables, the previous fallback to store-derived default columns has been removed; consider preserving a fallback (e.g. to defaultStoreColumns / defaultTableColumns.columns) when appConfig does not define default list settings to avoid regressions or runtime issues.
  • You are casting defaultConfigColumns to TableColumn[] without checking for undefined in both components; it would be safer to guard against missing config before calling convertSavedColumns or provide a sensible default array.
  • The console.log("Dataset ngOnInit", ...) in DatasetTableComponent looks like leftover debug logging and should be removed or routed through the application's logging mechanism.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In both proposal and dataset tables, the previous fallback to store-derived default columns has been removed; consider preserving a fallback (e.g. to `defaultStoreColumns` / `defaultTableColumns.columns`) when `appConfig` does not define default list settings to avoid regressions or runtime issues.
- You are casting `defaultConfigColumns` to `TableColumn[]` without checking for `undefined` in both components; it would be safer to guard against missing config before calling `convertSavedColumns` or provide a sensible default array.
- The `console.log("Dataset ngOnInit", ...)` in `DatasetTableComponent` looks like leftover debug logging and should be removed or routed through the application's logging mechanism.

## Individual Comments

### Comment 1
<location> `src/app/proposals/proposal-table/proposal-table.component.ts:130-131` </location>
<code_context>
                 const tableSort = this.getTableSort();
                 const paginationConfig = this.getTablePaginationConfig(count);

+                const defaultConfigColumns = 
+                  this.appConfig?.defaultDatasetsListSettings?.columns;
+
</code_context>

<issue_to_address>
**issue (bug_risk):** Guard against missing or empty defaultConfigColumns before converting

Previously, missing/empty config columns fell back to `defaultStoreColumns`. Now `defaultConfigColumns` is passed straight into `convertSavedColumns` and cast to `TableColumn[]`, so an undefined/empty value could cause runtime errors or an empty table. Please either preserve the earlier fallback (e.g., to `userConfigColumns` or another default) or explicitly handle `!Array.isArray(defaultConfigColumns)` / `!defaultConfigColumns.length` before calling `convertSavedColumns`.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment on lines +130 to 131
const defaultConfigColumns =
this.appConfig?.defaultProposalsListSettings?.columns;
Copy link
Contributor

Choose a reason for hiding this comment

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

issue (bug_risk): Guard against missing or empty defaultConfigColumns before converting

Previously, missing/empty config columns fell back to defaultStoreColumns. Now defaultConfigColumns is passed straight into convertSavedColumns and cast to TableColumn[], so an undefined/empty value could cause runtime errors or an empty table. Please either preserve the earlier fallback (e.g., to userConfigColumns or another default) or explicitly handle !Array.isArray(defaultConfigColumns) / !defaultConfigColumns.length before calling convertSavedColumns.

@nitrosx nitrosx changed the title Tables columns reset to default fix: tables columns reset to default Feb 6, 2026
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