Fix muted-words now returning null instead of ""

## Issue
Creating Settings suddenly start to stop loading correctly for some of my channels.

## Change
`settings.List` now returns null instead of empty array. Double-checked the Commentron repo and this is indeed the case.

Updated the code to handle null.
This commit is contained in:
infinite-persistence 2021-07-23 15:45:04 +08:00
parent 7a8d213861
commit 6e402240b0
No known key found for this signature in database
GPG key ID: B9C3252EDC3D0AA0
2 changed files with 8 additions and 1 deletions

View file

@ -1390,7 +1390,9 @@ export const doFetchCreatorSettings = (channelClaimIds: Array<string> = []) => {
const channelId = channelSignatures[i].claim_id; const channelId = channelSignatures[i].claim_id;
settingsByChannelId[channelId] = settings[i]; settingsByChannelId[channelId] = settings[i];
settingsByChannelId[channelId].words = settingsByChannelId[channelId].words.split(','); if (settings[i].words) {
settingsByChannelId[channelId].words = settings[i].words.split(',');
}
delete settingsByChannelId[channelId].channel_name; delete settingsByChannelId[channelId].channel_name;
delete settingsByChannelId[channelId].channel_id; delete settingsByChannelId[channelId].channel_id;

View file

@ -986,6 +986,11 @@ export default handleActions(
fetchingSettings: false, fetchingSettings: false,
}), }),
[ACTIONS.COMMENT_FETCH_SETTINGS_COMPLETED]: (state: CommentsState, action: any) => { [ACTIONS.COMMENT_FETCH_SETTINGS_COMPLETED]: (state: CommentsState, action: any) => {
// TODO: This is incorrect, as it could make 'settingsByChannelId' store
// only 1 channel with other channel's data purged. It works for now
// because the GUI only shows 1 channel's setting at a time, and *always*
// re-fetches to get latest data before displaying. Either rename this to
// 'activeChannelCreatorSettings', or append the new data properly.
return { return {
...state, ...state,
settingsByChannelId: action.data, settingsByChannelId: action.data,