Implement webworker for save operation + Limit the history size #29

Merged
Siklos merged 3 commits from dev.optimize into dev 2022-08-15 11:52:18 -04:00
Showing only changes of commit 5c4c73dbf9 - Show all commits

View file

@ -18,12 +18,11 @@ interface IEditorProps {
historyCurrentStep: number
}
export const getCurrentHistory = (history: IHistoryState[], historyCurrentStep: number): IHistoryState[] => {
return history.slice(
Math.max(0, history.length - MAX_HISTORY),
export const getCurrentHistory = (history: IHistoryState[], historyCurrentStep: number): IHistoryState[] =>
history.slice(
Math.max(0, history.length - MAX_HISTORY), // change this to 0 for unlimited (not recommanded because of overflow)
historyCurrentStep + 1
);
};
export const getCurrentHistoryState = (history: IHistoryState[], historyCurrentStep: number): IHistoryState => history[historyCurrentStep];