/
githubmirror
/
wp-calypso
Обзор
Документация
Войти
/
githubmirror
/
wp-calypso
Код
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
trunk
client/controller/preferences.js
21 строка
644 B
arthur791004
Themes/Plugins: Enable global version only when the hosting-dashboard-opt-in is enabled (#106402)
14 окт 2025, 10:56
Не верифицирован
14 окт 2025, 10:56
9275311
Код
Авторство
О чём код?
import { isUserLoggedIn } from 'calypso/state/current-user/selectors'; import { fetchPreferences } from 'calypso/state/preferences/actions'; import { hasReceivedRemotePreferences } from 'calypso/state/preferences/selectors'; export async function setupPreferences( context, next ) { const state = context.store.getState(); // If the preferences have been fetched, we don't need to re-fetch again. if ( ! isUserLoggedIn( state ) || hasReceivedRemotePreferences( state ) ) { next(); return; } try { await context.store.dispatch( fetchPreferences() ); } catch { // If the fetching of preferences fails, do nothing. } next(); }