Apply ultra-concise settings shortcuts to TopMessage and HomeView

- TopMessage: Replace 50+ lines of settings logic with single () call
- HomeView: Replace databaseUtil calls with () and ()
- Remove unused imports (MASTER_SETTINGS_KEY, databaseUtil) from HomeView
- Settings updates now use automatic cache invalidation for performance
- Reduce settings boilerplate by 80-90% with cached shortcuts
This commit is contained in:
Matthew Raymer
2025-07-02 10:51:27 +00:00
parent 07256393ba
commit 193447ee8a
2 changed files with 20 additions and 64 deletions

View File

@@ -320,8 +320,7 @@ import {
} from "../constants/app";
import { logConsoleAndDb } from "../db/index";
import { Contact } from "../db/tables/contacts";
import { BoundingBox, checkIsAnyFeedFilterOn, MASTER_SETTINGS_KEY } from "../db/tables/settings";
import * as databaseUtil from "../db/databaseUtil";
import { BoundingBox, checkIsAnyFeedFilterOn } from "../db/tables/settings";
import {
contactForDid,
containsNonHiddenDid,
@@ -610,11 +609,8 @@ export default class HomeView extends Vue {
this.activeDid,
);
if (resp.status === 200) {
const currentSettings = await this.$settings();
await databaseUtil.updateDidSpecificSettings(this.activeDid, {
isRegistered: true,
...currentSettings,
});
// Ultra-concise settings update with automatic cache invalidation!
await this.$saveMySettings({ isRegistered: true });
this.isRegistered = true;
}
} catch (error) {
@@ -746,11 +742,8 @@ export default class HomeView extends Vue {
this.activeDid,
);
if (resp.status === 200) {
const currentSettings = await this.$settings();
await databaseUtil.updateDidSpecificSettings(this.activeDid, {
isRegistered: true,
...currentSettings,
});
// Ultra-concise settings update with automatic cache invalidation!
await this.$saveMySettings({ isRegistered: true });
this.isRegistered = true;
}
} catch (e) {
@@ -873,7 +866,7 @@ export default class HomeView extends Vue {
/**
* Reloads feed when filter settings change using ultra-concise mixin utilities
* - Updates filter states
* - Clears existing feed data
* - Clears existing feed data
* - Triggers new feed load
*
* @public
@@ -1328,7 +1321,8 @@ export default class HomeView extends Vue {
this.feedLastViewedClaimId == null ||
this.feedLastViewedClaimId < records[0].jwtId
) {
await databaseUtil.updateDefaultSettings({
// Ultra-concise default settings update with automatic cache invalidation!
await this.$saveSettings({
lastViewedClaimId: records[0].jwtId,
});
}