e8fe66f91cdf91bccaa92ecaf2db91c97d0b588c
Three bugs caused settings toggles to get stuck or reset: 1. useEncryptedSettings: onSuccess was updating the parsedSettings cache under the old event ID, causing NostrSync to re-apply the stale remote event when the new one arrived with a different ID. Fixed by using the signed event's ID for both cache entries. 2. ContentTypeRow/SubKindRow: handleToggle was building the Nostr payload from the local React feedSettings state, which lags behind on rapid successive toggles. Fixed by merging against the Nostr-cached settings (nostrSettings?.feedSettings) as the base instead. 3. NostrSync: lastSyncedTimestamp ref reset to 0 on every page reload, so the 10-second recentlyWritten() guard was the only protection against stale relay events overwriting local changes. Fixed by seeding the ref with the current remote lastSync on first settings load, skipping application of any event that isn't strictly newer than what was already in the cache.
Description
Languages
TypeScript
95.7%
Java
1.5%
JavaScript
0.9%
Swift
0.9%
CSS
0.5%
Other
0.4%