Trim saved profiles to non-default filter values - #1239
Conversation
useStorage.getState() was saved verbatim, including every filter key at its default value - the whole point of a profile backup is the handful a user actually changed, not the full menu. The task filter feature just added a large new set of possible keys on top of the existing rocket/invasion/quest ones, making this far more likely to hit the existing 413 "backup too large" handling than before. createBackupData() diffs the current filters against the server's live defaults (useMemory.filters) and keeps only what differs. Safe on load: the backup write already clears localStorage and reloads the page, so useMapData's existing deepMerge(serverDefaults, loadedState) fills back in anything omitted because it matched the default at save time. Also adds error feedback to the Update button, which previously failed silently on the same 413 this was written to reduce. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7fcec3e743
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| <Typography | ||
| variant="caption" | ||
| color="error" | ||
| sx={{ mt: 1, alignSelf: 'flex-start' }} |
There was a problem hiding this comment.
Remove the unapproved update-error margin
When an update fails and the error caption is rendered, mt: 1 introduces new top-margin spacing without the user's explicit written permission. Remove this margin or obtain permission before changing the spacing.
AGENTS.md reference: AGENTS.md:L7-L7
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Pull request overview
Compacts saved profiles by omitting filter values matching server defaults.
Changes:
- Adds recursive filter comparison while preserving unknown keys.
- Uses compact payloads for create and update operations.
- Adds update error handling.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/features/profile/Backups.jsx |
Applies compact payloads and displays update errors. |
src/features/profile/backupData.js |
Implements recursive backup compaction. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| <Typography | ||
| variant="caption" | ||
| color="error" | ||
| sx={{ mt: 1, alignSelf: 'flex-start' }} |
|
|
||
| /** @param {unknown} err @param {(key: string) => string} t */ | ||
| function getBackupErrorMessage(err, t) { | ||
| let message = t('backup_error_generic') |
Summary
Reduce saved profile payloads by storing only filter values that differ from the current server defaults.
This is independent of quest task filtering: ReactMap already merges a large dynamically generated filter tree into client state, so profiles can serialise thousands of default-valued entries. Additional dynamic filter categories only make that existing scaling issue easier to reach.
Problem
Profile creation and updating currently submit the complete persisted client state after available filters have been merged into it. Most generated filter entries are identical to the defaults supplied by the server, but are still repeated in every profile payload.
On a map with a large available filter set, the resulting
backups.datainsert became large enough to fail during testing.Changes
Loading continues to use the existing default merge, so omitted default values are restored while explicit user selections remain intact. This avoids requiring a MySQL/MariaDB schema change.
Validation
main(8ce212ff).git diff --checkpasses.Backups.jsxand the newbackupData.jshelper.This is being submitted separately from the Rocket identity fix and quest task filtering so it can be reviewed as an independent profile-storage improvement.