mirror of
https://github.com/whippyshou/mastodon
synced 2024-12-04 17:58:44 +09:00
Prevent duplicate concurrent calls of /api/*/instance
in web UI (#25663)
This commit is contained in:
parent
0512537eb6
commit
5b46345459
@ -19,6 +19,10 @@ export const SERVER_DOMAIN_BLOCKS_FETCH_SUCCESS = 'SERVER_DOMAIN_BLOCKS_FETCH_SU
|
|||||||
export const SERVER_DOMAIN_BLOCKS_FETCH_FAIL = 'SERVER_DOMAIN_BLOCKS_FETCH_FAIL';
|
export const SERVER_DOMAIN_BLOCKS_FETCH_FAIL = 'SERVER_DOMAIN_BLOCKS_FETCH_FAIL';
|
||||||
|
|
||||||
export const fetchServer = () => (dispatch, getState) => {
|
export const fetchServer = () => (dispatch, getState) => {
|
||||||
|
if (getState().getIn(['server', 'server', 'isLoading'])) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
dispatch(fetchServerRequest());
|
dispatch(fetchServerRequest());
|
||||||
|
|
||||||
api(getState)
|
api(getState)
|
||||||
@ -66,6 +70,10 @@ const fetchServerTranslationLanguagesFail = error => ({
|
|||||||
});
|
});
|
||||||
|
|
||||||
export const fetchExtendedDescription = () => (dispatch, getState) => {
|
export const fetchExtendedDescription = () => (dispatch, getState) => {
|
||||||
|
if (getState().getIn(['server', 'extendedDescription', 'isLoading'])) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
dispatch(fetchExtendedDescriptionRequest());
|
dispatch(fetchExtendedDescriptionRequest());
|
||||||
|
|
||||||
api(getState)
|
api(getState)
|
||||||
@ -89,6 +97,10 @@ const fetchExtendedDescriptionFail = error => ({
|
|||||||
});
|
});
|
||||||
|
|
||||||
export const fetchDomainBlocks = () => (dispatch, getState) => {
|
export const fetchDomainBlocks = () => (dispatch, getState) => {
|
||||||
|
if (getState().getIn(['server', 'domainBlocks', 'isLoading'])) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
dispatch(fetchDomainBlocksRequest());
|
dispatch(fetchDomainBlocksRequest());
|
||||||
|
|
||||||
api(getState)
|
api(getState)
|
||||||
|
@ -161,7 +161,7 @@ class About extends PureComponent {
|
|||||||
</Section>
|
</Section>
|
||||||
|
|
||||||
<Section title={intl.formatMessage(messages.rules)}>
|
<Section title={intl.formatMessage(messages.rules)}>
|
||||||
{!isLoading && (server.get('rules').isEmpty() ? (
|
{!isLoading && (server.get('rules', []).isEmpty() ? (
|
||||||
<p><FormattedMessage id='about.not_available' defaultMessage='This information has not been made available on this server.' /></p>
|
<p><FormattedMessage id='about.not_available' defaultMessage='This information has not been made available on this server.' /></p>
|
||||||
) : (
|
) : (
|
||||||
<ol className='rules-list'>
|
<ol className='rules-list'>
|
||||||
|
@ -17,15 +17,15 @@ import {
|
|||||||
|
|
||||||
const initialState = ImmutableMap({
|
const initialState = ImmutableMap({
|
||||||
server: ImmutableMap({
|
server: ImmutableMap({
|
||||||
isLoading: true,
|
isLoading: false,
|
||||||
}),
|
}),
|
||||||
|
|
||||||
extendedDescription: ImmutableMap({
|
extendedDescription: ImmutableMap({
|
||||||
isLoading: true,
|
isLoading: false,
|
||||||
}),
|
}),
|
||||||
|
|
||||||
domainBlocks: ImmutableMap({
|
domainBlocks: ImmutableMap({
|
||||||
isLoading: true,
|
isLoading: false,
|
||||||
isAvailable: true,
|
isAvailable: true,
|
||||||
items: ImmutableList(),
|
items: ImmutableList(),
|
||||||
}),
|
}),
|
||||||
|
Loading…
Reference in New Issue
Block a user