Skip to content

fix: apply lastReceived field format changes in custom feeds#6187

Open
DragonBot00 wants to merge 1 commit intokeephq:mainfrom
DragonBot00:fix/custom-feed-lastReceived-format
Open

fix: apply lastReceived field format changes in custom feeds#6187
DragonBot00 wants to merge 1 commit intokeephq:mainfrom
DragonBot00:fix/custom-feed-lastReceived-format

Conversation

@DragonBot00
Copy link
Copy Markdown

Summary

Fixes #5236

Problem

In custom (backend-persisted) feeds, changing the format of the lastReceived field via the column header dropdown had no visible effect. The format change appeared to succeed silently - no error was shown - but the column continued rendering timestamps in the previous format.

Root Cause

Custom feeds (non-static presets) use a backend API to persist column configuration, including columnTimeFormats. This is managed by the usePresetColumnState hook, which reads and writes format settings via usePresetColumnConfig. The AlertTableServerSide component correctly passes the synced columnTimeFormats to the table via table.options.meta.

However, the cell renderers in useAlertTableCols (inside alert-table-utils.tsx) read columnTimeFormats exclusively from React local storage via useLocalStorage -- a closure-captured value that is never updated when the backend state changes. This caused the visual display to remain stale even after the backend was successfully updated.

Fix

  • Updated both time-aware cell renderers in useAlertTableCols (the lastReceived accessor and the generic date column renderer in filteredAndGeneratedCols) to prefer context.table.options.meta?.columnTimeFormats over the local storage fallback. This ensures custom feeds render using the authoritative, backend-synced format.
  • Extended the TableMeta interface declaration in keep-ui/types/react-table.d.ts to include columnTimeFormats and setColumnTimeFormats, providing proper TypeScript typing for the table metadata already set by AlertTableServerSide.

Static presets and the deprecated AlertTable component are unaffected -- they do not set meta.columnTimeFormats, so the local storage fallback continues to apply.

Files Changed

  • keep-ui/widgets/alerts-table/lib/alert-table-utils.tsx -- read columnTimeFormats from table meta when available
  • keep-ui/types/react-table.d.ts -- extend TableMeta with columnTimeFormats and setColumnTimeFormats

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 1, 2026

@DragonBot00 is attempting to deploy a commit to the KeepHQ Team on Vercel.

A member of the Team first needs to authorize it.

@DragonBot00
Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. Bug Something isn't working labels Apr 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something isn't working size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[🐛 Bug]: lastReceived field format in custom feeds is not changed

1 participant