0

I have the following shouldUpdate call

shouldUpdate(changedProperties: PropertyValues): boolean {
    if (changedProperties.has("mobile") &&
        !this._isOpeningDialog &&
        this._testStore.isShareSheetOpen) {
        this._testStore.closeShareSheet();
    }

    return this._isOpeningDialog;
}

I need to check if the mobile property has changed and if so update the element. However, this seems like an anti-pattern. Does anyone have a better way to do this?

this._testStore.closeShareSheet() causes the element to re-render and shouldUpdate to be called.

nakhodkin
  • 1,327
  • 1
  • 17
  • 27
Chris Hansen
  • 7,813
  • 15
  • 81
  • 165
  • 1
    Is `mobile` already a reactive property? Then changing it already causes a re-render. No need to check. What do you mean `this_testStore.closeShareSheet()` causes the element to re-render? Are you talking about the same element or a different one? – Augustine Kim Dec 16 '22 at 22:53

0 Answers0