Skip to content

Commit

Permalink
fix: migrate deprecated performUpdate api to scheduleUpdate
Browse files Browse the repository at this point in the history
  • Loading branch information
tlouisse committed Feb 21, 2024
1 parent 9b9e789 commit eb46728
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
5 changes: 5 additions & 0 deletions .changeset/fresh-moles-reflect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@lion/ui': patch
---

migrate deprecated `performUpdate` api to `scheduleUpdate`
Original file line number Diff line number Diff line change
Expand Up @@ -163,20 +163,20 @@ export const runRegistrationSuite = customConfig => {
});

it('works for components that have a delayed render', async () => {
class PerformUpdate extends FormRegistrarMixin(LitElement) {
async performUpdate() {
class ScheduleUpdate extends FormRegistrarMixin(LitElement) {
async scheduleUpdate() {
// eslint-disable-next-line no-promise-executor-return
await new Promise(resolve => setTimeout(() => resolve(undefined), 10));
await super.performUpdate();
await super.scheduleUpdate();
}

render() {
return html`<slot></slot>`;
}
}
const tagWrapperString = defineCE(PerformUpdate);
const tagWrapperString = defineCE(ScheduleUpdate);
const tagWrapper = unsafeStatic(tagWrapperString);
const el = /** @type {PerformUpdate} */ (
const el = /** @type {ScheduleUpdate} */ (
await fixture(html`
<${tagWrapper}>
<${childTag}></${childTag}>
Expand Down Expand Up @@ -359,10 +359,10 @@ export const runRegistrationSuite = customConfig => {
it('works for portals that have a delayed render', async () => {
const delayedPortalString = defineCE(
class extends FormRegistrarPortalMixin(LitElement) {
async performUpdate() {
async scheduleUpdate() {
// eslint-disable-next-line no-promise-executor-return
await new Promise(resolve => setTimeout(() => resolve(undefined), 10));
await super.performUpdate();
await super.scheduleUpdate();
}

render() {
Expand Down
4 changes: 2 additions & 2 deletions packages/ui/components/localize/src/LocalizeMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ const LocalizeMixinImplementation = superclass =>
* hook into LitElement to only render once all translations are loaded
* @returns {Promise.<void>}
*/
async performUpdate() {
async scheduleUpdate() {
if (Object.getPrototypeOf(this).constructor.waitForLocalizeNamespaces) {
await this.localizeNamespacesLoaded;
}
super.performUpdate();
super.scheduleUpdate();
}

connectedCallback() {
Expand Down

0 comments on commit eb46728

Please sign in to comment.