Fix for settings reset

This commit is contained in:
Bojan Mojsilovic 2023-11-06 15:54:54 +01:00
parent b415744936
commit 0ac94efb6a

View File

@ -339,7 +339,8 @@ export const SettingsProvider = (props: { children: ContextChildren }) => {
getDefaultSettings(subid)
};
const loadSettings = (pubkey: string | undefined) => {
const loadSettings = (pubkey: string | undefined, then?: () => void) => {
if (!pubkey) {
return;
}
@ -439,6 +440,7 @@ export const SettingsProvider = (props: { children: ContextChildren }) => {
updateStore('defaultFeed', () => store.availableFeeds[0]);
then && then();
unsub();
return;
});
@ -516,6 +518,7 @@ export const SettingsProvider = (props: { children: ContextChildren }) => {
// addAvailableFeed(trendingFeed, true, false);
// }
loadSettings(publicKey, () => {
const fwr = initFeeds?.find(f => f.hex === feedLatestWithReplies.hex && f.includeReplies === feedLatestWithReplies.includeReplies);
// Add active user's feed if it's missing
@ -530,9 +533,7 @@ export const SettingsProvider = (props: { children: ContextChildren }) => {
if (initFeeds && !initFeeds.find(f => f.hex === feedLatest.hex && f.includeReplies === feedLatest.includeReplies)) {
addAvailableFeed(feedLatest, true, false);
}
setTimeout(() => {
loadSettings(publicKey);
}, 100);
});
});
createEffect(() => {