amiletti / spapp

Simple single page jquery application library
8 stars 4 forks source link

feat: added reloadView option #3

Open AlbaraHassan opened 4 months ago

amiletti commented 4 months ago

I've tried your fork, but i had seen that in case you have an html inserted directly in a section, on page change, you lost this content.

In your fork go to view 1 ad come back to view 3. You don't have the html content of view 3

AlbaraHassan commented 4 months ago

I understand the issue you've encountered where the HTML content inserted directly into a section is lost upon changing routes. This behavior might seem unexpected, but it's aligned with the design pattern where changing routes typically involves removing the HTML content of the previous route. This behavior is consistent across various development stacks and frameworks.

However, I acknowledge that this behavior might not be desirable in all scenarios, in one project i am working on i actually need this behaviour, so maybe it's not a bad idea to actually just have it as an option to behave this way. One approach we could consider is to document this behavior explicitly in the library documentation, particularly for users who opt to utilize the reloadView option. By clarifying this behavior in the documentation, users can make informed decisions about whether to enable this option based on their specific use cases and requirements. This approach ensures transparency and empowers users to leverage the functionality of the SPApp library effectively while understanding its implications.

amiletti commented 4 months ago

currently I don't have much to work on this project. I think, without having looked at the code, one solution can be move the config "reloadView" from global config to single view config. In this way only the view configured to reload remove his content