diff --git a/src/routes/Settings/Settings.js b/src/routes/Settings/Settings.js index d98a24267..c90b7150e 100644 --- a/src/routes/Settings/Settings.js +++ b/src/routes/Settings/Settings.js @@ -21,7 +21,7 @@ const Settings = () => { const { core } = useServices(); const { routeFocused } = useRouteFocused(); const profile = useProfile(); - const dataExport = useDataExport(); + const [dataExport, loadDataExport] = useDataExport(); const streamingServer = useStreamingServer(); const { interfaceLanguageSelect, @@ -84,10 +84,8 @@ const Settings = () => { // TODO }, []); const exportDataOnClick = React.useCallback(() => { - if (dataExport.exportUrl !== null && typeof dataExport.exportUrl === 'string') { - window.open(dataExport.exportUrl); - } - }, [dataExport.exportUrl]); + loadDataExport(); + }, []); const reloadStreamingServer = React.useCallback(() => { core.transport.dispatch({ action: 'StreamingServer', @@ -132,6 +130,11 @@ const Settings = () => { const sectionsContainerOnScorll = React.useCallback(throttle(() => { updateSelectedSectionId(); }, 50), []); + React.useEffect(() => { + if (dataExport.exportUrl !== null && typeof dataExport.exportUrl === 'string') { + window.open(dataExport.exportUrl); + } + }, [dataExport.exportUrl]); React.useLayoutEffect(() => { if (routeFocused) { updateSelectedSectionId(); @@ -244,7 +247,7 @@ const Settings = () => {