Keep track of opened views and the changes in viewmodel


#1

Hi,
In our project, we are implementing a navigation tab with list of opened views and user can navigate between them.

How can we keep track of changes made in one view and when he moves back and forth keep those changes and load? ( we do not want to save it to back- end until user decides that he finished with changes and click save.)

Current apporach we are using is by saving it to a custom dictionary. Which will hold the type of view and id as Key and Viewmodel as Value.
Since there can be large data, we do not feel that is a better idea to keep list of Viewmodels in memory

One option - Before navigating away from view, show a popup asking if he wants to save or cancel changes before leaving the view.

But this is not something our customer wants (saving everytime)

In our earlier silverlight projects we used agatha container to hold the opened views and viewmodel instances and resolve it when navigating.

Is there any similar solution that any one suggest in JS framework or any Aurelia component life cycle stages?
Looking forward for suggestions.

Thank you.


#2

Could the Aurelia Store plugin be of help?


#3

Can the pending changes in states be moved to a separate model instead of sitting inside the view model ?


#4

Hi,
I miss typed in my original question. I am not using the whole Viewmodel, but I have custom object that has parts of view model and still I feel it is large.

Thank you for the suggestion though.


#5

Thank you jeffgrann, I will try that.