Skip to content

Commit

Permalink
perf(memory): Reduce usage when switching sections
Browse files Browse the repository at this point in the history
  • Loading branch information
ypetitot-externe committed Jan 2, 2022
1 parent 3db7db9 commit a706592
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions src/App/app.actions.js
Original file line number Diff line number Diff line change
@@ -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',
Expand Down

0 comments on commit a706592

Please sign in to comment.