fix(bootstrap-data): always check flashes (#22659)
This commit is contained in:
parent
0b22287ad9
commit
73e53fab7a
|
|
@ -388,13 +388,12 @@ def menu_data(user: User) -> Dict[str, Any]:
|
|||
|
||||
|
||||
@cache_manager.cache.memoize(timeout=60)
|
||||
def common_bootstrap_payload(user: User) -> Dict[str, Any]:
|
||||
def cached_common_bootstrap_data(user: User) -> Dict[str, Any]:
|
||||
"""Common data always sent to the client
|
||||
|
||||
The function is memoized as the return value only changes based
|
||||
on configuration and feature flag values.
|
||||
The function is memoized as the return value only changes when user permissions
|
||||
or configuration values change.
|
||||
"""
|
||||
messages = get_flashed_messages(with_categories=True)
|
||||
locale = str(get_locale())
|
||||
|
||||
# should not expose API TOKEN to frontend
|
||||
|
|
@ -418,7 +417,6 @@ def common_bootstrap_payload(user: User) -> Dict[str, Any]:
|
|||
frontend_config["HAS_GSHEETS_INSTALLED"] = bool(available_specs[GSheetsEngineSpec])
|
||||
|
||||
bootstrap_data = {
|
||||
"flash_messages": messages,
|
||||
"conf": frontend_config,
|
||||
"locale": locale,
|
||||
"language_pack": get_language_pack(locale),
|
||||
|
|
@ -432,6 +430,13 @@ def common_bootstrap_payload(user: User) -> Dict[str, Any]:
|
|||
return bootstrap_data
|
||||
|
||||
|
||||
def common_bootstrap_payload(user: User) -> Dict[str, Any]:
|
||||
return {
|
||||
**(cached_common_bootstrap_data(user)),
|
||||
"flash_messages": get_flashed_messages(with_categories=True),
|
||||
}
|
||||
|
||||
|
||||
def get_error_level_from_status_code( # pylint: disable=invalid-name
|
||||
status: int,
|
||||
) -> ErrorLevel:
|
||||
|
|
|
|||
Loading…
Reference in New Issue