From 93fb22c34c0e6adecde78c253872fabd25321dda Mon Sep 17 00:00:00 2001 From: wadii Date: Thu, 26 Jun 2025 11:22:38 +0200 Subject: [PATCH 01/11] fix: migrated-maintenance-to-fc-and-ts --- .../{Maintenance.js => Maintenance.tsx} | 37 +++++++------------ 1 file changed, 13 insertions(+), 24 deletions(-) rename frontend/web/components/{Maintenance.js => Maintenance.tsx} (51%) diff --git a/frontend/web/components/Maintenance.js b/frontend/web/components/Maintenance.tsx similarity index 51% rename from frontend/web/components/Maintenance.js rename to frontend/web/components/Maintenance.tsx index db7d8fe6a3e2..101d9e31ad31 100644 --- a/frontend/web/components/Maintenance.js +++ b/frontend/web/components/Maintenance.tsx @@ -1,34 +1,21 @@ import React from 'react' import ConfigProvider from 'common/providers/ConfigProvider' -const HomePage = class extends React.Component { - static displayName = 'HomePage' - - constructor(props, context) { - super(props, context) - this.state = {} - } - - render = () => ( +const MaintenancePage: React.FC = () => { + return (

Maintenance

We are currently undergoing some scheduled maintenance of the admin site, this will not affect your application's feature flags. - { - <> - {' '} - Check{' '} - - @getflagsmith - {' '} - for updates. - - } + <> + {' '} + Check{' '} + + @getflagsmith + {' '} + for updates. +

Sorry for the inconvenience, we will be back up and running shortly. @@ -38,4 +25,6 @@ const HomePage = class extends React.Component { ) } -module.exports = ConfigProvider(HomePage) +MaintenancePage.displayName = 'MaintenancePage' + +export default ConfigProvider(MaintenancePage) From b9ebcd070f842207a12014c5c620c62a963b1a00 Mon Sep 17 00:00:00 2001 From: wadii Date: Thu, 26 Jun 2025 16:46:00 +0200 Subject: [PATCH 02/11] fix: allow-dashboard-for-fof-errors --- frontend/api/index.js | 1 + frontend/common/stores/base/_store.js | 4 +-- frontend/common/stores/config-store.js | 13 ++++++-- frontend/common/utils/utils.tsx | 3 +- frontend/global.d.ts | 1 + frontend/web/components/App.js | 30 +++++++++++++++---- .../web/components/base/errors/init.error.ts | 25 ++++++++++++++++ 7 files changed, 65 insertions(+), 12 deletions(-) create mode 100644 frontend/web/components/base/errors/init.error.ts diff --git a/frontend/api/index.js b/frontend/api/index.js index 6302af8af8b6..c36666d4b2d8 100755 --- a/frontend/api/index.js +++ b/frontend/api/index.js @@ -49,6 +49,7 @@ app.get('/config/project-overrides', (req, res) => { */ const values = [ + { name: 'isFlagsmithOnFlagsmith', value: !!process.env.FLAGSMITH_ON_FLAGSMITH_API_KEY && !!process.env.FLAGSMITH_ON_FLAGSMITH_API_URL }, { name: 'preventSignup', value: envToBool('PREVENT_SIGNUP', false) }, { name: 'preventEmailPassword', diff --git a/frontend/common/stores/base/_store.js b/frontend/common/stores/base/_store.js index 1f17ec97fff2..13286ff7bd11 100644 --- a/frontend/common/stores/base/_store.js +++ b/frontend/common/stores/base/_store.js @@ -32,9 +32,9 @@ module.exports = Object.assign({}, EventEmitter.prototype, { isSaving: false, - loaded() { + loaded(persistError = false) { this.hasLoaded = true - this.error = null + this.error = persistError ? this.error : null this.isLoading = false this.trigger(DEFAULT_LOADED_EVENT) this.trigger(DEFAULT_CHANGE_EVENT) diff --git a/frontend/common/stores/config-store.js b/frontend/common/stores/config-store.js index ac07da6f3fc1..6557921c46a7 100644 --- a/frontend/common/stores/config-store.js +++ b/frontend/common/stores/config-store.js @@ -21,7 +21,14 @@ const controller = { store.model = flagsmith.getAllFlags() }, onError() { - store.error = true + if (Project.isFlagsmithOnFlagsmith) { + store.model = {} + // TODO: Migrate to TS and use enum + store.error = 'fof_init_error' + store.loaded(true) + return + } + store.error = 'unknown' store.goneABitWest() }, } @@ -44,11 +51,11 @@ const enableDynatrace = !!window.enableDynatrace && typeof dtrum !== 'undefined' flagsmith .init({ AsyncStorage, - api: Project.flagsmithClientAPI, + api: '', //Project.flagsmithClientAPI, cacheFlags: true, enableAnalytics: Project.flagsmithAnalytics, enableDynatrace, - environmentID: Project.flagsmith, + environmentID: '', onChange: controller.loaded, realtime: Project.flagsmithRealtime, }) diff --git a/frontend/common/utils/utils.tsx b/frontend/common/utils/utils.tsx index 42f882b4d5d5..b9d9ac052207 100644 --- a/frontend/common/utils/utils.tsx +++ b/frontend/common/utils/utils.tsx @@ -206,7 +206,8 @@ const Utils = Object.assign({}, require('./base/_utils'), { * only add behaviour to Flagsmith-on-Flagsmith flags that have been explicitly created by customers. */ flagsmithFeatureExists(flag: string) { - return Object.prototype.hasOwnProperty.call(flagsmith.getAllFlags(), flag) + const allFlags = flagsmith?.getAllFlags() + return allFlags && Object.prototype.hasOwnProperty.call(allFlags, flag) }, getContentType(contentTypes: ContentType[], model: string, type: string) { return contentTypes.find((c: ContentType) => c[model] === type) || null diff --git a/frontend/global.d.ts b/frontend/global.d.ts index f792a06a5cb9..ec95400c5578 100644 --- a/frontend/global.d.ts +++ b/frontend/global.d.ts @@ -38,6 +38,7 @@ declare global { theme?: string, expiry?: number, action?: { buttonText: string; onClick: () => void }, + position?: 'top' | 'bottom', ) => void const Flex: typeof Component const isMobile: boolean diff --git a/frontend/web/components/App.js b/frontend/web/components/App.js index dea51e195b80..6374ed4c6784 100644 --- a/frontend/web/components/App.js +++ b/frontend/web/components/App.js @@ -16,14 +16,17 @@ import { Provider } from 'react-redux' import { getStore } from 'common/store' import { resolveAuthFlow } from '@datadog/ui-extensions-sdk' import ConfigProvider from 'common/providers/ConfigProvider' -import Button from './base/forms/Button' import Icon from './Icon' import AccountStore from 'common/stores/account-store' import OrganisationLimit from './OrganisationLimit' import GithubStar from './GithubStar' -import Tooltip from './Tooltip' import classNames from 'classnames' import { apps, gitBranch, gitCompare, statsChart } from 'ionicons/icons' +import { + getStartupErrorText, + isFlagsmithOnFlagsmithError, + isMaintenanceError, +} from './base/errors/init.error' import NavSubLink from './navigation/NavSubLink' import SettingsIcon from './svg/SettingsIcon' import UsersIcon from './svg/UsersIcon' @@ -304,9 +307,24 @@ const App = class extends Component { ) { return } - if (Project.maintenance || this.props.error || !window.projectOverrides) { + const maintenanceMode = + Utils.getFlagsmithHasFeature('maintenance_mode') || Project.maintenance + const isUnknownError = + this.props.error && !isFlagsmithOnFlagsmithError(this.props.error) + if (maintenanceMode || !window.projectOverrides || isUnknownError) { return } + + if (this.props.error && isFlagsmithOnFlagsmithError(this.props.error)) { + toast( + getStartupErrorText(this.props.error), + 'danger', + 2 * 60 * 1000, + undefined, + 'top', + ) + } + const activeProject = OrganisationStore.getProject(projectId) const projectNotLoaded = !activeProject && document.location.href.includes('project/') @@ -326,20 +344,20 @@ const App = class extends Component { ) } + if (AccountStore.forced2Factor()) { return } + if (document.location.pathname.includes('widget')) { return

{this.props.children}
} const isOrganisationSelect = document.location.pathname === '/organisations' const integrations = Object.keys(Utils.getIntegrationData()) - const environmentMetricsEnabled = Utils.getFlagsmithHasFeature( - 'environment_metrics', - ) const projectMetricsTooltipEnabled = Utils.getFlagsmithHasFeature( 'project_metrics_tooltip', ) + return ( = { + [FlagsmithStartupErrors.FOF_INIT_ERROR]: + 'Flagsmith on Flagsmith initialisation error. Please check your configuration', + [FlagsmithStartupErrors.MAINTENANCE_MODE]: 'Maintenance mode', + [FlagsmithStartupErrors.UNKNOWN_ERROR]: + 'Unexpected error. If it persists, please contact support', +} + +export const getStartupErrorText = (error: FlagsmithStartupErrors) => { + return errorLabels[error] || errorLabels[FlagsmithStartupErrors.UNKNOWN_ERROR] +} + +export const isMaintenanceError = (error: FlagsmithStartupErrors) => { + return error === FlagsmithStartupErrors.MAINTENANCE_MODE +} + +export const isFlagsmithOnFlagsmithError = (error: FlagsmithStartupErrors) => { + return error === FlagsmithStartupErrors.FOF_INIT_ERROR +} From 2510397e312fa4b766eeeca87f75619a92e48597 Mon Sep 17 00:00:00 2001 From: wadii Date: Thu, 26 Jun 2025 17:10:36 +0200 Subject: [PATCH 03/11] fix: reverted-local-values --- frontend/common/stores/config-store.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/common/stores/config-store.js b/frontend/common/stores/config-store.js index 6557921c46a7..ef997a615e2a 100644 --- a/frontend/common/stores/config-store.js +++ b/frontend/common/stores/config-store.js @@ -51,11 +51,11 @@ const enableDynatrace = !!window.enableDynatrace && typeof dtrum !== 'undefined' flagsmith .init({ AsyncStorage, - api: '', //Project.flagsmithClientAPI, + api: Project.flagsmithClientAPI, cacheFlags: true, enableAnalytics: Project.flagsmithAnalytics, enableDynatrace, - environmentID: '', + environmentID: Project.flagsmith, onChange: controller.loaded, realtime: Project.flagsmithRealtime, }) From dfda1872b2367c4e32cc5e6810926653ed7400a8 Mon Sep 17 00:00:00 2001 From: wadii Date: Fri, 27 Jun 2025 11:27:57 +0200 Subject: [PATCH 04/11] fix: log-init-error --- frontend/common/stores/config-store.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/frontend/common/stores/config-store.js b/frontend/common/stores/config-store.js index ef997a615e2a..321e82e56f44 100644 --- a/frontend/common/stores/config-store.js +++ b/frontend/common/stores/config-store.js @@ -59,7 +59,8 @@ flagsmith onChange: controller.loaded, realtime: Project.flagsmithRealtime, }) - .catch(() => { + .catch((e) => { + console.error(e) controller.onError() }) From 65a74038fa9ad30a6c4cf6e80cb5fed3060f2f18 Mon Sep 17 00:00:00 2001 From: wadii Date: Fri, 27 Jun 2025 16:02:25 +0200 Subject: [PATCH 05/11] chore: added-link-to-documentation-and-and-extra-styles-in-toast --- frontend/common/stores/config-store.js | 4 ++-- frontend/global.d.ts | 1 - frontend/web/components/App.js | 12 +++++++++--- frontend/web/project/toast.tsx | 7 +++++++ frontend/web/styles/components/_toast.scss | 4 ++++ 5 files changed, 22 insertions(+), 6 deletions(-) diff --git a/frontend/common/stores/config-store.js b/frontend/common/stores/config-store.js index 321e82e56f44..dafc2ca7ff57 100644 --- a/frontend/common/stores/config-store.js +++ b/frontend/common/stores/config-store.js @@ -51,11 +51,11 @@ const enableDynatrace = !!window.enableDynatrace && typeof dtrum !== 'undefined' flagsmith .init({ AsyncStorage, - api: Project.flagsmithClientAPI, + api: '', //Project.flagsmithClientAPI, cacheFlags: true, enableAnalytics: Project.flagsmithAnalytics, enableDynatrace, - environmentID: Project.flagsmith, + environmentID: '', // Project.flagsmith, onChange: controller.loaded, realtime: Project.flagsmithRealtime, }) diff --git a/frontend/global.d.ts b/frontend/global.d.ts index ec95400c5578..f792a06a5cb9 100644 --- a/frontend/global.d.ts +++ b/frontend/global.d.ts @@ -38,7 +38,6 @@ declare global { theme?: string, expiry?: number, action?: { buttonText: string; onClick: () => void }, - position?: 'top' | 'bottom', ) => void const Flex: typeof Component const isMobile: boolean diff --git a/frontend/web/components/App.js b/frontend/web/components/App.js index 6374ed4c6784..26efa229403e 100644 --- a/frontend/web/components/App.js +++ b/frontend/web/components/App.js @@ -25,7 +25,6 @@ import { apps, gitBranch, gitCompare, statsChart } from 'ionicons/icons' import { getStartupErrorText, isFlagsmithOnFlagsmithError, - isMaintenanceError, } from './base/errors/init.error' import NavSubLink from './navigation/NavSubLink' import SettingsIcon from './svg/SettingsIcon' @@ -320,8 +319,15 @@ const App = class extends Component { getStartupErrorText(this.props.error), 'danger', 2 * 60 * 1000, - undefined, - 'top', + { + buttonText: 'See documentation', + onClick: () => + window.open( + 'https://docs.flagsmith.com/deployment/#running-flagsmith-on-flagsmith', + '_blank', + ), + }, + { size: 'large' }, ) } diff --git a/frontend/web/project/toast.tsx b/frontend/web/project/toast.tsx index f2cd888f0f6c..81d631892d76 100644 --- a/frontend/web/project/toast.tsx +++ b/frontend/web/project/toast.tsx @@ -22,12 +22,14 @@ export interface MessageProps { isRemoving?: boolean theme?: ThemeType children?: React.ReactNode + extraStyles?: { size?: 'large' | undefined } } const Message: FC = ({ action, children, expiry = 5000, + extraStyles, isRemoving = false, remove, theme = 'success', @@ -40,6 +42,7 @@ const Message: FC = ({ const className = cn( { 'alert': true, + 'large': extraStyles?.size === 'large', 'removing-out': isRemoving, 'show': !isRemoving, 'toast-message': true, @@ -87,6 +90,7 @@ export interface Message { expiry?: number theme?: ThemeType isRemoving?: boolean + extraStyles?: { size?: 'large' | undefined } } const ToastMessages: FC<{}> = () => { @@ -97,6 +101,7 @@ const ToastMessages: FC<{}> = () => { theme?: ThemeType, expiry?: number, action?: { buttonText: string; onClick: () => void }, + extraStyles?: { size?: 'large' | undefined }, ) => { setMessages((prevMessages) => { // Ignore duplicate messages @@ -110,6 +115,7 @@ const ToastMessages: FC<{}> = () => { action, content, expiry: E2E ? 1000 : expiry, + extraStyles, id, theme, }, @@ -149,6 +155,7 @@ const ToastMessages: FC<{}> = () => { remove={() => remove(message.id)} expiry={message.expiry} theme={message.theme} + extraStyles={message.extraStyles} > {message.content} diff --git a/frontend/web/styles/components/_toast.scss b/frontend/web/styles/components/_toast.scss index 6cb0b5eaee23..a2ebb94f2d5e 100644 --- a/frontend/web/styles/components/_toast.scss +++ b/frontend/web/styles/components/_toast.scss @@ -66,6 +66,10 @@ animation: toast-out 0.3s ease-out forwards; } + &.large { + width: 520px !important; + } + @media screen and (min-width: 768px) { width: 320px; } From 8608b45b88b693badbddea839307778975aca8c5 Mon Sep 17 00:00:00 2001 From: wadii Date: Fri, 27 Jun 2025 16:18:26 +0200 Subject: [PATCH 06/11] fix: reverted-local-env-variables --- frontend/common/stores/config-store.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/common/stores/config-store.js b/frontend/common/stores/config-store.js index dafc2ca7ff57..321e82e56f44 100644 --- a/frontend/common/stores/config-store.js +++ b/frontend/common/stores/config-store.js @@ -51,11 +51,11 @@ const enableDynatrace = !!window.enableDynatrace && typeof dtrum !== 'undefined' flagsmith .init({ AsyncStorage, - api: '', //Project.flagsmithClientAPI, + api: Project.flagsmithClientAPI, cacheFlags: true, enableAnalytics: Project.flagsmithAnalytics, enableDynatrace, - environmentID: '', // Project.flagsmith, + environmentID: Project.flagsmith, onChange: controller.loaded, realtime: Project.flagsmithRealtime, }) From 0b97cd673fe4361d6d50d272cdb44c1f34075f81 Mon Sep 17 00:00:00 2001 From: wadii Date: Mon, 30 Jun 2025 10:00:49 +0200 Subject: [PATCH 07/11] fix: display-error-from-sdk-in-toast --- frontend/common/stores/base/_store.js | 1 + frontend/common/stores/config-store.js | 15 ++++++++--- frontend/package-lock.json | 9 ++++--- frontend/package.json | 2 +- frontend/web/components/App.js | 1 + .../web/components/base/errors/init.error.ts | 26 ++++++++++++++----- 6 files changed, 38 insertions(+), 16 deletions(-) diff --git a/frontend/common/stores/base/_store.js b/frontend/common/stores/base/_store.js index 13286ff7bd11..34c2e38d9ac5 100644 --- a/frontend/common/stores/base/_store.js +++ b/frontend/common/stores/base/_store.js @@ -18,6 +18,7 @@ module.exports = Object.assign({}, EventEmitter.prototype, { // console.log('change', this.id) this.trigger(DEFAULT_CHANGE_EVENT) }, + // Config store uses {type: FlagsmithStartupErrors, message: string} error: null, goneABitWest() { this.hasLoaded = true diff --git a/frontend/common/stores/config-store.js b/frontend/common/stores/config-store.js index 321e82e56f44..de72eaa61e4c 100644 --- a/frontend/common/stores/config-store.js +++ b/frontend/common/stores/config-store.js @@ -20,15 +20,22 @@ const controller = { } store.model = flagsmith.getAllFlags() }, - onError() { + onError(e) { if (Project.isFlagsmithOnFlagsmith) { store.model = {} // TODO: Migrate to TS and use enum - store.error = 'fof_init_error' + store.error = { + message: e?.message, + type: 'fof_init_error', + } store.loaded(true) return } - store.error = 'unknown' + + store.error = { + message: e, + type: 'unknown', + } store.goneABitWest() }, } @@ -61,7 +68,7 @@ flagsmith }) .catch((e) => { console.error(e) - controller.onError() + controller.onError(e) }) controller.store = store diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 516f1e5ad341..95d4eb5bbcf2 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -54,7 +54,7 @@ "fbjs": "^3.0.4", "fetchify": "0.0.2", "file-loader": "6.2.0", - "flagsmith": "^9.0.0", + "flagsmith": "^9.2.2", "flux-react-dispatcher": "1.2.5", "free-email-domains": "^1.2.14", "fs-extra": "2.0.0", @@ -9942,9 +9942,10 @@ } }, "node_modules/flagsmith": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/flagsmith/-/flagsmith-9.0.0.tgz", - "integrity": "sha512-hIipa+/ymTYtyEeDU181iEiZ6NbSXEpcYqJdRaY2A9zRhDh3sHNCqXvtWMxOuVOrBEt4HZZ/IsJ4eAsIV5me9A==" + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/flagsmith/-/flagsmith-9.2.2.tgz", + "integrity": "sha512-9UNI5Rdtv4r3rEruT3sLinZDKH1o7co8kSopmGDB5q9fCWHXLa1HLbjAwe9xPoMtWMpdS8gqLdY2UZBdfxuVdg==", + "license": "BSD-3-Clause" }, "node_modules/flat": { "version": "5.0.2", diff --git a/frontend/package.json b/frontend/package.json index 6d1ce6e52ac9..24601407029e 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -78,7 +78,7 @@ "fbjs": "^3.0.4", "fetchify": "0.0.2", "file-loader": "6.2.0", - "flagsmith": "^9.0.0", + "flagsmith": "^9.2.2", "flux-react-dispatcher": "1.2.5", "free-email-domains": "^1.2.14", "fs-extra": "2.0.0", diff --git a/frontend/web/components/App.js b/frontend/web/components/App.js index 26efa229403e..00eef208c757 100644 --- a/frontend/web/components/App.js +++ b/frontend/web/components/App.js @@ -306,6 +306,7 @@ const App = class extends Component { ) { return } + console.log(this.props.error) const maintenanceMode = Utils.getFlagsmithHasFeature('maintenance_mode') || Project.maintenance const isUnknownError = diff --git a/frontend/web/components/base/errors/init.error.ts b/frontend/web/components/base/errors/init.error.ts index 6c2d7c053351..6600651ebf89 100644 --- a/frontend/web/components/base/errors/init.error.ts +++ b/frontend/web/components/base/errors/init.error.ts @@ -4,22 +4,34 @@ export enum FlagsmithStartupErrors { MAINTENANCE_MODE = 'maintenance_mode', } +export interface SDKInitErrors { + type: FlagsmithStartupErrors + message: string +} + const errorLabels: Record = { [FlagsmithStartupErrors.FOF_INIT_ERROR]: - 'Flagsmith on Flagsmith initialisation error. Please check your configuration', + 'Please check your Flagsmith configuration', [FlagsmithStartupErrors.MAINTENANCE_MODE]: 'Maintenance mode', [FlagsmithStartupErrors.UNKNOWN_ERROR]: 'Unexpected error. If it persists, please contact support', } -export const getStartupErrorText = (error: FlagsmithStartupErrors) => { - return errorLabels[error] || errorLabels[FlagsmithStartupErrors.UNKNOWN_ERROR] +export const getStartupErrorText = (error: SDKInitErrors) => { + switch (error?.type) { + case FlagsmithStartupErrors.FOF_INIT_ERROR: + return `${error?.message}. ${errorLabels[error?.type]}` + case FlagsmithStartupErrors.MAINTENANCE_MODE: + return errorLabels[error?.type] + default: + return errorLabels[FlagsmithStartupErrors.UNKNOWN_ERROR] + } } -export const isMaintenanceError = (error: FlagsmithStartupErrors) => { - return error === FlagsmithStartupErrors.MAINTENANCE_MODE +export const isMaintenanceError = (error: SDKInitErrors) => { + return error?.type === FlagsmithStartupErrors.MAINTENANCE_MODE } -export const isFlagsmithOnFlagsmithError = (error: FlagsmithStartupErrors) => { - return error === FlagsmithStartupErrors.FOF_INIT_ERROR +export const isFlagsmithOnFlagsmithError = (error: SDKInitErrors) => { + return error?.type === FlagsmithStartupErrors.FOF_INIT_ERROR } From 753a9e21b78394a57cc52684baa533a6f860065e Mon Sep 17 00:00:00 2001 From: wadii Date: Mon, 30 Jun 2025 16:46:34 +0200 Subject: [PATCH 08/11] fix: removed-log --- frontend/web/components/App.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/web/components/App.js b/frontend/web/components/App.js index 00eef208c757..09fc6ddc7ede 100644 --- a/frontend/web/components/App.js +++ b/frontend/web/components/App.js @@ -306,7 +306,7 @@ const App = class extends Component { ) { return } - console.log(this.props.error) + const maintenanceMode = Utils.getFlagsmithHasFeature('maintenance_mode') || Project.maintenance const isUnknownError = From 7d59c95051540570dfba51099502dbfe9970c36f Mon Sep 17 00:00:00 2001 From: wadii Date: Mon, 30 Jun 2025 16:47:12 +0200 Subject: [PATCH 09/11] fix: added-check-for-fof-from-project-files --- frontend/common/stores/config-store.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/frontend/common/stores/config-store.js b/frontend/common/stores/config-store.js index de72eaa61e4c..7b4e29c9d789 100644 --- a/frontend/common/stores/config-store.js +++ b/frontend/common/stores/config-store.js @@ -21,7 +21,10 @@ const controller = { store.model = flagsmith.getAllFlags() }, onError(e) { - if (Project.isFlagsmithOnFlagsmith) { + if ( + Project.isFlagsmithOnFlagsmith || + (!Project.flagsmith && !Project.flagsmithClientAPI) + ) { store.model = {} // TODO: Migrate to TS and use enum store.error = { From c47ee6ac323463c6a5efa1fae2354ed228888550 Mon Sep 17 00:00:00 2001 From: wadii Date: Wed, 2 Jul 2025 13:47:27 +0200 Subject: [PATCH 10/11] fix: added-fof-error-handling-in-butterbar --- frontend/web/components/App.js | 1 + frontend/web/components/ButterBar.tsx | 36 ++++++++++++++++++++++++++- 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/frontend/web/components/App.js b/frontend/web/components/App.js index 09fc6ddc7ede..5f50fa222576 100644 --- a/frontend/web/components/App.js +++ b/frontend/web/components/App.js @@ -380,6 +380,7 @@ const App = class extends Component { billingStatus={ AccountStore.getOrganisation()?.subscription.billing_status } + fofError={this.props.error?.message} /> {projectNotLoaded ? (
diff --git a/frontend/web/components/ButterBar.tsx b/frontend/web/components/ButterBar.tsx index 7803de3cfc96..4a9bdbcd7388 100644 --- a/frontend/web/components/ButterBar.tsx +++ b/frontend/web/components/ButterBar.tsx @@ -13,9 +13,14 @@ import Constants from 'common/constants' interface ButterBarProps { billingStatus?: string projectId: string + fofError?: string } -const ButterBar: React.FC = ({ billingStatus, projectId }) => { +const ButterBar: React.FC = ({ + billingStatus, + fofError, + projectId, +}) => { const matches = document.location.href.match(/\/environment\/([^/]*)/) const environment = matches && matches[1] const timerRef = useRef() @@ -59,6 +64,35 @@ const ButterBar: React.FC = ({ billingStatus, projectId }) => { return processing }, [checkProcessing, featureImports]) + if (fofError) { + return ( +
+ +
Could not initialise Flagsmith-on-Flagsmith
+
+

The error was: "{fofError}"

+

+ Flag evaluation for is not affected, but some dashboard features might + be unavailable. +

+

+ Check with{' '} + + Flagsmith-on-Flagsmith documentation + {' '} + for more info. +

+
+ ) + } + if (processingImport) { return (
From 5f6ebeda8f9fdb7327470885bfaf81ba1987a7c2 Mon Sep 17 00:00:00 2001 From: wadii Date: Wed, 2 Jul 2025 17:19:03 +0200 Subject: [PATCH 11/11] fix: reverted-flagsmith-upgrade --- frontend/package-lock.json | 8 ++++---- frontend/package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 95d4eb5bbcf2..110f0ddd5f8c 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -54,7 +54,7 @@ "fbjs": "^3.0.4", "fetchify": "0.0.2", "file-loader": "6.2.0", - "flagsmith": "^9.2.2", + "flagsmith": "^9.0.0", "flux-react-dispatcher": "1.2.5", "free-email-domains": "^1.2.14", "fs-extra": "2.0.0", @@ -9942,9 +9942,9 @@ } }, "node_modules/flagsmith": { - "version": "9.2.2", - "resolved": "https://registry.npmjs.org/flagsmith/-/flagsmith-9.2.2.tgz", - "integrity": "sha512-9UNI5Rdtv4r3rEruT3sLinZDKH1o7co8kSopmGDB5q9fCWHXLa1HLbjAwe9xPoMtWMpdS8gqLdY2UZBdfxuVdg==", + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/flagsmith/-/flagsmith-9.0.0.tgz", + "integrity": "sha512-hIipa+/ymTYtyEeDU181iEiZ6NbSXEpcYqJdRaY2A9zRhDh3sHNCqXvtWMxOuVOrBEt4HZZ/IsJ4eAsIV5me9A==", "license": "BSD-3-Clause" }, "node_modules/flat": { diff --git a/frontend/package.json b/frontend/package.json index 24601407029e..6d1ce6e52ac9 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -78,7 +78,7 @@ "fbjs": "^3.0.4", "fetchify": "0.0.2", "file-loader": "6.2.0", - "flagsmith": "^9.2.2", + "flagsmith": "^9.0.0", "flux-react-dispatcher": "1.2.5", "free-email-domains": "^1.2.14", "fs-extra": "2.0.0",