Skip to content

Commit

Permalink
perf(memory): Reduce usage when switching sections (#466)
Browse files Browse the repository at this point in the history
  • Loading branch information
yadPe authored Mar 13, 2022
1 parent c4c6e1b commit bc9fcf9
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 bc9fcf9

Please sign in to comment.