Ensured mercure updates are not set even if supported, when they have been disabled

This commit is contained in:
Alejandro Celaya
2020-04-25 10:37:50 +02:00
parent 6fcf588bfd
commit 16dee3664b
6 changed files with 26 additions and 12 deletions

View File

@@ -9,6 +9,7 @@ import SortingDropdown from '../utils/SortingDropdown';
import { determineOrderDir } from '../utils/utils';
import { MercureInfoType } from '../mercure/reducers/mercureInfo';
import { bindToMercureTopic } from '../mercure/helpers';
import { RealTimeUpdatesType } from '../settings/reducers/realTimeUpdates';
import { shortUrlType } from './reducers/shortUrlsList';
import { shortUrlsListParamsType } from './reducers/shortUrlsListParams';
import './ShortUrlsList.scss';
@@ -33,6 +34,7 @@ const propTypes = {
createNewVisit: PropTypes.func,
loadMercureInfo: PropTypes.func,
mercureInfo: MercureInfoType,
realTimeUpdates: RealTimeUpdatesType,
};
// FIXME Replace with typescript: (ShortUrlsRow component)
@@ -50,6 +52,7 @@ const ShortUrlsList = (ShortUrlsRow) => {
createNewVisit,
loadMercureInfo,
mercureInfo,
realTimeUpdates,
}) => {
const { orderBy } = shortUrlsListParams;
const [ order, setOrder ] = useState({
@@ -117,7 +120,7 @@ const ShortUrlsList = (ShortUrlsRow) => {
return resetShortUrlParams;
}, []);
useEffect(
bindToMercureTopic(mercureInfo, 'https://shlink.io/new-visit', createNewVisit, loadMercureInfo),
bindToMercureTopic(mercureInfo, realTimeUpdates, 'https://shlink.io/new-visit', createNewVisit, loadMercureInfo),
[ mercureInfo ]
);

View File

@@ -31,7 +31,7 @@ const provideServices = (bottle, connect) => {
bottle.serviceFactory('ShortUrlsList', ShortUrlsList, 'ShortUrlsRow');
bottle.decorator('ShortUrlsList', connect(
[ 'selectedServer', 'shortUrlsListParams', 'mercureInfo' ],
[ 'selectedServer', 'shortUrlsListParams', 'mercureInfo', 'realTimeUpdates' ],
[ 'listShortUrls', 'resetShortUrlParams', 'createNewVisit', 'loadMercureInfo' ]
));