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

View state storage #3865

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open

View state storage #3865

wants to merge 5 commits into from

Conversation

lbwexler
Copy link
Member

Hoist P/R Checklist

Pull request authors: Review and check off the below. Items that do not apply can also be
checked off to indicate they have been considered. If unclear if a step is relevant, please leave
unchecked and note in comments.

  • Caught up with develop branch as of last change.
  • Added CHANGELOG entry, or determined not required.
  • Reviewed for breaking changes, added breaking-change label + CHANGELOG if so.
  • Updated doc comments / prop-types, or determined not required.
  • Reviewed and tested on Mobile, or determined not required.
  • Created Toolbox branch / PR, or determined not required.

If your change is still a WIP, please use the "Create draft pull request" option in the split
button below to indicate it is not ready yet for a final review.

Pull request reviewers: when merging this P/R, please consider using a squash commit to
collapse multiple intermediate commits into a single commit representing the overall feature
change. This helps keep the commit log clean and easy to scan across releases. PRs containing a
single commit should be rebased when possible.

@lbwexler lbwexler requested a review from ghsolomon December 19, 2024 18:04
track: () => [this.view, this.userPinned, this.autoSave],
run: () => api.updateStateAsync(),
debounce: 5 * SECONDS,
fireImmediately: this.view.token != initialToken
Copy link
Contributor

@ghsolomon ghsolomon Dec 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious about the fireImmediately. Wondering why not always wait until the user has changed something?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wanted to catch case where existing view was being re-written because it was no longer present, or a different one. On the fence here for sure

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see- so when a user's current view is no longer available, either the "default" view or a code-specified "initial view" will be loaded, and that view will be immediately persisted as the user's current view? I wonder if it would be better to clean (remove) their persisted current view in that case since it's no longer a view they chose. To do that might just adding unnecessary complexity though.

Along similar lines - is it strange that pinning a view will also cause a user's current view to be persisted? I'm not sure it's really an issue, but wanted to flag.

*
* @internal
*/
export class DataAccess<T> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A general question - do we have any other classes like this, or named like this? Just trying to relate this to any patterns we already have for breaking up functionality along these lines.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't find a direct analog, and as you might have noticed, I have been playing around with various names for it.

The class gets a lot thinner with the move to a server-side view service, so probably less necessary but thought it was worth it to keep it around, with the main class being so large.

@lbwexler lbwexler marked this pull request as ready for review December 26, 2024 11:35
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

Successfully merging this pull request may close these issues.

3 participants