Skip to content

Commit

Permalink
fix(widgets): infinite load on Media Share and Emote Wall (#5273)
Browse files Browse the repository at this point in the history
* fix: emote wall widget and custom code/fields

* fix(widgets): media share widget infinite load
  • Loading branch information
blackxored authored Jan 7, 2025
1 parent b14a448 commit 9761254
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app/components-react/widgets/common/useWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ export class WidgetModule<TWidgetState extends IWidgetState = IWidgetState> {
]);

this.setStaticConfig(staticConfig);
if (staticConfig) {
if (staticConfig?.data?.custom_code) {
// I miss lenses
const makeLenses = (type: 'html' | 'css' | 'js') => {
const prop = `custom_${type}`;
Expand Down
1 change: 1 addition & 0 deletions app/components/widgets/WidgetSettings.vue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}
}
Expand Down
4 changes: 2 additions & 2 deletions app/services/widgets/settings/emote-wall.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ export class EmoteWallService extends WidgetSettingsService<IEmoteWallData> {
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,
};
}
Expand Down
2 changes: 1 addition & 1 deletion app/services/widgets/settings/widget-settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export abstract class WidgetSettingsService<TWidgetData extends IWidgetData>

// 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
Expand Down
4 changes: 2 additions & 2 deletions app/services/widgets/widgets-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 9761254

Please sign in to comment.