Skip to content

Commit 7173d3d

Browse files
Merge pull request #13188 from mezonai/bug26b/webdesktop/Cannot-switch-event-type-while-editing-event
260528 - web/desktop - Cannot switch event type while editing event
2 parents 3efc617 + 1a970c2 commit 7173d3d

1 file changed

Lines changed: 11 additions & 9 deletions

File tree

  • libs/components/src/lib/components/ChannelList/EventChannelModal/ModalCreate

libs/components/src/lib/components/ChannelList/EventChannelModal/ModalCreate/index.tsx

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -93,16 +93,18 @@ const ModalCreate = (props: ModalCreateProps) => {
9393
const isExistPrivateEvent = currentEvent?.is_private;
9494

9595
useEffect(() => {
96-
if (currentEvent && eventChannel) {
97-
if (isExistChannelVoice) {
98-
setOption(OptionEvent.OPTION_SPEAKER);
99-
} else if (isExistAddress) {
100-
setOption(OptionEvent.OPTION_LOCATION);
101-
} else if (isExistPrivateEvent) {
102-
setOption(OptionEvent.PRIVATE_EVENT);
103-
}
96+
if (!currentEvent || option) {
97+
return;
98+
}
99+
100+
if (isExistChannelVoice) {
101+
setOption(OptionEvent.OPTION_SPEAKER);
102+
} else if (isExistAddress) {
103+
setOption(OptionEvent.OPTION_LOCATION);
104+
} else if (isExistPrivateEvent) {
105+
setOption(OptionEvent.PRIVATE_EVENT);
104106
}
105-
}, [currentEvent, eventChannel]);
107+
}, [currentEvent, option, isExistChannelVoice, isExistAddress, isExistPrivateEvent]);
106108

107109
const choiceSpeaker = useMemo(() => {
108110
return option === OptionEvent.OPTION_SPEAKER || (!option && isExistChannelVoice && !isExistAddress && !isExistPrivateEvent);

0 commit comments

Comments
 (0)