perf(memory): Reduce usage when switching sections (#466)

This commit is contained in:
Yannis Petitot
2022-03-13 18:39:55 +01:00
committed by GitHub
parent c4c6e1bcd8
commit bc9fcf9e9d
+16 -4
View File
@@ -1,7 +1,19 @@
export const changeCurrentSection = (sectionName, params = {}) => ({
type: 'UPDATEACTIVESECTION',
payload: { sectionName, params },
});
import { webFrame } from 'electron';
/**
* Action creator will call clearCache as a side effect
* @param {string} sectionName
* @param {Record<string, any>} params
* @returns
*/
export const changeCurrentSection = (sectionName, params = {}) => {
// Used to clear web frame cache especially images when changing section since there is no real navigation in the app for chromium to to it by itself
webFrame.clearCache();
return {
type: 'UPDATEACTIVESECTION',
payload: { sectionName, params },
};
};
export const clearSectionParams = () => ({
type: 'CLEAR_ACTIVE_SECTION_PARAMS',