Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make context reload manual, and freeze context on incompatible or forced upgrade #3478

Closed
anthony-murphy opened this issue Sep 2, 2020 · 1 comment
Assignees
Labels
area: runtime Runtime related issues
Milestone

Comments

@anthony-murphy
Copy link
Contributor

anthony-murphy commented Sep 2, 2020

Context reload is currently a complicated process to expose and consume. In many cases it will require a refresh of the page hosting the container. If we are not very careful this could result in data loss.

Rather than building complicated detection, interception, and cancellation logic, i propose we change the fundamental mechanism here. Rather than automatically closing and reloading the context, we should split this is two.

On an incompatible code proposal an event should be fired, and the current context should become readonly, no longer accepting any local or remote operations.

There should be a mechanism the host can call at this point to manually reload the context, or ask the user to refresh the page. Ideally, we can detect this in a way to prevent data loss, such that no pending changes are accepted that won't be able to be round tripped.

For backwards compatibility we should maintain the current behavior with the NullRuntime to a real runtime.

The detection method that the context has been frozen should also be extensible, as there are other cases, like server side file operations (delete, restore, ...) that could also result in the context needing to be frozen

@anthony-murphy
Copy link
Contributor Author

it is possible we can leverage the existing behavior of closing the container rather than closing the context only.

anthony-murphy added a commit that referenced this issue Oct 12, 2020
Add some straight forward end to end tests so we can validate changes needed for #3481 and #3478
anthony-murphy added a commit that referenced this issue Oct 20, 2020
This event is needed in versioning scenarios, as a host may not want to reload context on the current page, they may instead want an alternate flow, like closing the container, and forcing a page refresh.

Changes:

Add contextDisposed event. Add previous code details to both contextDisposed and contextChanged.
Handling for closed container on context reload path.
Move code loading into context to more cleanly bind a context to a specific code detail
Add and improve tests to cover context disposed, and closing container on context dispose

related #1281
related #3478
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: runtime Runtime related issues
Projects
None yet
Development

No branches or pull requests

2 participants