From 9761254e7f2098a2331533d83f93163576fce177 Mon Sep 17 00:00:00 2001 From: Adrian Perez Date: Tue, 7 Jan 2025 10:08:57 -0800 Subject: [PATCH] fix(widgets): infinite load on Media Share and Emote Wall (#5273) * fix: emote wall widget and custom code/fields * fix(widgets): media share widget infinite load --- app/components-react/widgets/common/useWidget.tsx | 2 +- app/components/widgets/WidgetSettings.vue.ts | 1 + app/services/widgets/settings/emote-wall.ts | 4 ++-- app/services/widgets/settings/widget-settings.ts | 2 +- app/services/widgets/widgets-config.ts | 4 ++-- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/app/components-react/widgets/common/useWidget.tsx b/app/components-react/widgets/common/useWidget.tsx index 6c8e95c349dc..5c35d9b35d98 100644 --- a/app/components-react/widgets/common/useWidget.tsx +++ b/app/components-react/widgets/common/useWidget.tsx @@ -293,7 +293,7 @@ export class WidgetModule { ]); this.setStaticConfig(staticConfig); - if (staticConfig) { + if (staticConfig?.data?.custom_code) { // I miss lenses const makeLenses = (type: 'html' | 'css' | 'js') => { const prop = `custom_${type}`; diff --git a/app/components/widgets/WidgetSettings.vue.ts b/app/components/widgets/WidgetSettings.vue.ts index 35b207f45aec..d3cbbe9286a6 100644 --- a/app/components/widgets/WidgetSettings.vue.ts +++ b/app/components/widgets/WidgetSettings.vue.ts @@ -59,6 +59,7 @@ export default class WidgetSettings< this.requestState = 'success'; this.afterFetch(); } catch (e: unknown) { + console.error('Something failed on widget settings fetch', e); this.requestState = 'fail'; } } diff --git a/app/services/widgets/settings/emote-wall.ts b/app/services/widgets/settings/emote-wall.ts index af163a68c2d6..8a03b70709a1 100644 --- a/app/services/widgets/settings/emote-wall.ts +++ b/app/services/widgets/settings/emote-wall.ts @@ -36,8 +36,8 @@ export class EmoteWallService extends WidgetSettingsService { dataFetchUrl: `https://${this.getHost()}/api/v5/slobs/widget/emote-wall`, settingsSaveUrl: `https://${this.getHost()}/api/v5/slobs/widget/emote-wall`, settingsUpdateEvent: 'emoteWallSettingsUpdate', - customCodeAllowed: true, - customFieldsAllowed: true, + customCodeAllowed: false, + customFieldsAllowed: false, hasTestButtons: true, }; } diff --git a/app/services/widgets/settings/widget-settings.ts b/app/services/widgets/settings/widget-settings.ts index 89dc4453dda3..ff07eb8c4844 100644 --- a/app/services/widgets/settings/widget-settings.ts +++ b/app/services/widgets/settings/widget-settings.ts @@ -140,7 +140,7 @@ export abstract class WidgetSettingsService // TODO: type const { staticConfig }: any = this.state; - if (staticConfig) { + if (staticConfig?.data?.custom_code) { // These seem only used to restore defaults data.custom_defaults = staticConfig.data?.custom_code; // If we have a default for custom code and the fields are empty in the diff --git a/app/services/widgets/widgets-config.ts b/app/services/widgets/widgets-config.ts index 6e0fbba6822b..6152dd4cd608 100644 --- a/app/services/widgets/widgets-config.ts +++ b/app/services/widgets/widgets-config.ts @@ -150,8 +150,8 @@ export function getWidgetsConfig( dataFetchUrl: `https://${host}/api/v5/slobs/widget/emote-wall`, settingsSaveUrl: `https://${host}/api/v5/slobs/widget/emote-wall`, settingsUpdateEvent: 'emoteWallSettingsUpdate', - customCodeAllowed: true, - customFieldsAllowed: true, + customCodeAllowed: false, + customFieldsAllowed: false, }, // TODO: