fix(ui): fix slack/teams request duplication
This commit is contained in:
parent
40aee26521
commit
35f5bc6954
4 changed files with 13 additions and 5 deletions
|
|
@ -69,7 +69,7 @@ function ProjectDropdown(props: Props) {
|
|||
|
||||
{sites.map((site) => (
|
||||
<Menu.Item
|
||||
icon={<Icon name={site.platform === 'web' ? 'browser/browser' : 'mobile'} />}
|
||||
icon={<Icon name={site.platform === 'web' ? 'browser/browser' : 'mobile'} color={activeSite?.host === site.host ? 'main' : undefined} />}
|
||||
key={site.id}
|
||||
onClick={() => handleSiteChange(site.id)}
|
||||
className={cn('!py-2', activeSite?.host === site.host ? 'bg-active-blue' : '')}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,9 @@ import { fetchList as fetchTeams, sendMsTeamsMsg } from 'Duck/integrations/teams
|
|||
(state) => ({
|
||||
sessionId: state.getIn(['sessions', 'current']).sessionId,
|
||||
channels: state.getIn(['slack', 'list']),
|
||||
slackLoaded: state.getIn(['slack', 'loaded']),
|
||||
msTeamsChannels: state.getIn(['teams', 'list']),
|
||||
msTeamsLoaded: state.getIn(['teams', 'loaded']),
|
||||
tenantId: state.getIn(['user', 'account', 'tenantId']),
|
||||
}),
|
||||
{ fetchSlack, fetchTeams, sendSlackMsg, sendMsTeamsMsg }
|
||||
|
|
@ -31,10 +33,10 @@ export default class SharePopup extends React.PureComponent {
|
|||
|
||||
componentDidUpdate() {
|
||||
if (this.state.isOpen) {
|
||||
if (this.props.channels.size === 0) {
|
||||
if (this.props.channels.size === 0 && !this.props.slackLoaded) {
|
||||
this.props.fetchSlack();
|
||||
}
|
||||
if (this.props.msTeamsChannels.size === 0) {
|
||||
if (this.props.msTeamsChannels.size === 0 && !this.props.msTeamsLoaded) {
|
||||
this.props.fetchTeams();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,13 +15,16 @@ const itemInListUpdater = createItemInListUpdater(idKey);
|
|||
|
||||
const initialState = Map({
|
||||
instance: Config(),
|
||||
loaded: false,
|
||||
list: List(),
|
||||
});
|
||||
|
||||
const reducer = (state = initialState, action = {}) => {
|
||||
switch (action.type) {
|
||||
case FETCH_LIST.REQUEST:
|
||||
return state.set('loaded', true);
|
||||
case FETCH_LIST.SUCCESS:
|
||||
return state.set('list', List(action.data).map(Config));
|
||||
return state.set('list', List(action.data).map(Config)).set('loaded', true)
|
||||
case UPDATE.SUCCESS:
|
||||
case SAVE.SUCCESS:
|
||||
const config = Config(action.data);
|
||||
|
|
|
|||
|
|
@ -17,12 +17,15 @@ const itemInListUpdater = createItemInListUpdater(idKey);
|
|||
const initialState = Map({
|
||||
instance: Config(),
|
||||
list: List(),
|
||||
loaded: false,
|
||||
});
|
||||
|
||||
const reducer = (state = initialState, action = {}) => {
|
||||
switch (action.type) {
|
||||
case FETCH_LIST.REQUEST:
|
||||
return state.set('loaded', true);
|
||||
case FETCH_LIST.SUCCESS:
|
||||
return state.set('list', List(action.data).map(Config));
|
||||
return state.set('list', List(action.data).map(Config)).set('loaded', true);
|
||||
case UPDATE.SUCCESS:
|
||||
case SAVE.SUCCESS:
|
||||
const config = Config(action.data);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue