-
Notifications
You must be signed in to change notification settings - Fork 2
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
Fix shouldUpdate in entity-mixin-lit #482
base: main
Are you sure you want to change the base?
Conversation
PR Checklist:Did you use a semver keyword in a commit message?
Did you paste the Rally US URL in the description?
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is the right change -- it may break some tests in other repos potentially since rendering may happen a bit later.
@@ -35,7 +35,7 @@ export const EntityMixinLit = superclass => class extends superclass { | |||
this.href && this.token) { | |||
this._getEntity(); | |||
} | |||
return this.href && this.token; | |||
return this.href && this.token ? super.shouldUpdate(changedProperties) : false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually... localize-mixin.js
had to do a bunch of extra work to accomplish something similar, so I'm worried something is getting lost here. Like it's remembering the list of updated properties when it returns false
so that later when it can call super.shouldUpdate(changedProperties)
it can include all the ones that it skipped.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh interesting, I can look into that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's possible that it's overkill... you could probably just remember if super.shouldUpdate(changedProperties)
would have ever returned true
(when you're returning false
because href
/token
aren't defined yet) and then if so, return that value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah interesting, I think it's overkill for the use cases I know about because the localizeMixin
doesn't actually use the changedProperties
. But there could be another mixin after it that does... could this be turned into a controller mixins could use? 🤔
I'm a bit worried about this change, but in theory it should only be a good thing. Basically, anything using both the
EntityMixinLit
andcore
'sLocalizeDynamicMixin
isn't actually waiting until the langterms are loaded before rendering. This is probably only actually noticeable in the OSLO case, where langterms take a while to return.I think the fix below is the correct way to do this -
EntityMixinLit
gets the chance to say "no, don't update, we don't have anhref
/token
" but will then default to other mixin's requirements if its good to go with the update.Thoughts?