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

Harden views #3845

Merged
merged 2 commits into from
Dec 5, 2024
Merged

Harden views #3845

merged 2 commits into from
Dec 5, 2024

Conversation

lbwexler
Copy link
Member

@lbwexler lbwexler commented Dec 5, 2024

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 merged commit 878e7d4 into develop Dec 5, 2024
2 checks passed
@lbwexler lbwexler deleted the hardenViews branch December 5, 2024 19:07
}

constructor(info: ViewInfo, value: Partial<T>) {
constructor(info: ViewInfo, value: Partial<T>, model: ViewManagerModel) {
Copy link
Contributor

@ghsolomon ghsolomon Dec 5, 2024

Choose a reason for hiding this comment

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

Believe this should be model: ViewManagerModel<T>, but also curious why the backpointer to the model. Looks like just for the type and typedName.

}

static createDefault<T>(): View<T> {
return new View(null, {});
static createDefault<T>(model: ViewManagerModel): View<T> {
Copy link
Contributor

Choose a reason for hiding this comment

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

See comment in constructor re: generic ViewManagerModel type

get token(): string {
return this.info?.token ?? null;
get typedName(): string {
return `${this.model.typeDisplayName} '${this.name}'`;
}

static fromBlob<T>(blob: JsonBlob, model: ViewManagerModel): View<T> {
Copy link
Contributor

Choose a reason for hiding this comment

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

See comment in constructor re: generic ViewManagerModel type

@@ -33,24 +47,25 @@ export class View<T extends PlainObject = PlainObject> {
return this.info?.lastUpdated ?? null;
}

get token(): string {
return this.info?.token ?? null;
get typedName(): string {
Copy link
Contributor

Choose a reason for hiding this comment

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

Wonder if it would make sense to have a getTypedName helper that takes a view and a model or view and a type rather than having it be a top-level property on view itself

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.

2 participants