Fix instance api account merging (#37666)

This commit is contained in:
Echo
2026-01-30 10:30:22 +01:00
committed by GitHub
parent 0997ae0627
commit 0688e64a0b

View File

@@ -27,7 +27,15 @@ export const fetchServer = () => (dispatch, getState) => {
api()
.get('/api/v2/instance').then(({ data }) => {
if (data.contact.account) dispatch(importFetchedAccount(data.contact.account));
// Only import the account if it doesn't already exist,
// because the API is cached even for logged in users.
const account = data.contact.account;
if (account) {
const existingAccount = getState().getIn(['accounts', account.id]);
if (!existingAccount) {
dispatch(importFetchedAccount(account));
}
}
dispatch(fetchServerSuccess(data));
}).catch(err => dispatch(fetchServerFail(err)));
};