This repository was archived by the owner on Sep 11, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +14
-14
lines changed Expand file tree Collapse file tree 2 files changed +14
-14
lines changed Original file line number Diff line number Diff line change @@ -172,12 +172,7 @@ export default class AppTile extends React.Component {
172
172
componentDidUpdate ( ) {
173
173
// Allow parents to access widget messaging
174
174
if ( this . props . collectWidgetMessaging ) {
175
- this . props . collectWidgetMessaging ( new Promise ( ( resolve ) => {
176
- if ( this . widgetMessaging ) resolve ( this . widgetMessaging ) ;
177
-
178
- // Expect this to be resolved later
179
- this . _exposeWidgetMessaging = resolve ;
180
- } ) ) ;
175
+ this . props . collectWidgetMessaging ( this . widgetMessaging ) ;
181
176
}
182
177
}
183
178
Original file line number Diff line number Diff line change @@ -105,11 +105,7 @@ export default class Stickerpicker extends React.Component {
105
105
}
106
106
107
107
componentDidUpdate ( prevProps , prevState ) {
108
- if ( this . _appWidgetMessaging &&
109
- prevState . showStickers !== this . state . showStickers
110
- ) {
111
- this . _appWidgetMessaging . sendVisibility ( this . state . showStickers ) ;
112
- }
108
+ this . _sendVisibilityToWidget ( this . state . showStickers ) ;
113
109
}
114
110
115
111
_imError ( errorMsg , e ) {
@@ -147,10 +143,19 @@ export default class Stickerpicker extends React.Component {
147
143
) ;
148
144
}
149
145
150
- async _collectWidgetMessaging ( prom ) {
151
- const widgetMessaging = await prom ;
146
+ _collectWidgetMessaging ( widgetMessaging ) {
152
147
this . _appWidgetMessaging = widgetMessaging ;
153
- this . _appWidgetMessaging . sendVisibility ( true ) ;
148
+
149
+ // Do this now instead of in componentDidMount because we might not have had the
150
+ // reference to widgetMessaging when mounting
151
+ this . _sendVisibilityToWidget ( true ) ;
152
+ }
153
+
154
+ _sendVisibilityToWidget ( visible ) {
155
+ if ( this . _appWidgetMessaging && visible !== this . _prevSentVisibility ) {
156
+ this . _appWidgetMessaging . sendVisibility ( visible ) ;
157
+ this . _prevSentVisibility = visible ;
158
+ }
154
159
}
155
160
156
161
_getStickerpickerContent ( ) {
You can’t perform that action at this time.
0 commit comments