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

Domains manage their own history #507

Open
2 tasks
nhunzaker opened this issue Apr 23, 2018 · 0 comments
Open
2 tasks

Domains manage their own history #507

nhunzaker opened this issue Apr 23, 2018 · 0 comments

Comments

@nhunzaker
Copy link
Contributor

This is a placeholder issue for me to do some thinking about the relationship between History and Domains.

Right now domains already maintain a ledger of state revisions for outstanding actions. There is duplication between the history, it's underlying tree data structure, and this ledger. This isn't a functional issue, more of bad feel.

Instead, each domain could manage their own history. This would also let you do some pretty neat stuff:

  • Domains could undo/redo without affecting other "histories"
  • Should domains manage their own history?

Patch/Reset

This also allows an optimization for patch/reset: If a domain's state is patched, the state of all prior actions will always be overridden. There is no reason to process them. Unfortunately we can't do anything about this until Domains manage their own history (assuming this is a good idea)

A user logs out

There is another use case: What happens when a user logs out? In this case, you don't want to hold on to any information about the prior user, however this distinction might be split across several domains. It would be valuable to be able to "lose" revision history for a specific domain.

Domains in web workers

Additionally, if each domain has its own history, there's nothing tying them to the main thread. You could easily run a domain inside of a web-worker.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant