Move settings from store to another context

This commit is contained in:
Alejandro Celaya
2023-07-23 18:30:59 +02:00
parent dddbc232c2
commit b3122219be
37 changed files with 293 additions and 263 deletions

View File

@@ -66,12 +66,14 @@ export const selectServerListener = (
) => {
const listener = createListenerMiddleware();
listener.startListening({
actionCreator: selectServerThunk.fulfilled,
effect: ({ payload }, { dispatch }) => {
isReachableServer(payload) && dispatch(loadMercureInfo());
},
});
// TODO Find a way for the mercure info to be re-loaded when server changes, without leaking mercure implementation
// details
// listener.startListening({
// actionCreator: selectServerThunk.fulfilled,
// effect: ({ payload }, { dispatch }) => {
// isReachableServer(payload) && dispatch(loadMercureInfo());
// },
// });
return listener;
};

View File

@@ -1,7 +1,6 @@
import type Bottle from 'bottlejs';
import { prop } from 'ramda';
import type { ConnectDecorator } from '../../container/types';
import { Overview } from '../../shlink-web-component/overview/Overview';
import { CreateServer } from '../CreateServer';
import { DeleteServerButton } from '../DeleteServerButton';
import { DeleteServerModal } from '../DeleteServerModal';
@@ -63,12 +62,6 @@ export const provideServices = (bottle: Bottle, connect: ConnectDecorator) => {
bottle.serviceFactory('ServerError', ServerError, 'DeleteServerButton');
bottle.decorator('ServerError', connect(['servers', 'selectedServer']));
bottle.serviceFactory('Overview', Overview, 'ShortUrlsTable', 'CreateShortUrl');
bottle.decorator('Overview', connect(
['shortUrlsList', 'tagsList', 'selectedServer', 'mercureInfo', 'visitsOverview', 'settings'],
['listShortUrls', 'listTags', 'createNewVisits', 'loadMercureInfo', 'loadVisitsOverview'],
));
// Services
bottle.constant('fileReaderFactory', () => new FileReader());
bottle.service('ServersImporter', ServersImporter, 'csvToJson', 'fileReaderFactory');