Skip to content

Commit 4c77fba

Browse files
authored
Merge pull request #356 from andycarrell/unregister-on-unmount
Fix: Unregister load handler on unmount of Google API component
2 parents dfd6868 + c0e8b7b commit 4c77fba

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/GoogleApiComponent.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,12 @@ export const wrapper = input => WrappedComponent => {
8181
google: null
8282
});
8383
}
84+
85+
componentWillUnmount() {
86+
if (this.unregisterLoadHandler) {
87+
this.unregisterLoadHandler();
88+
}
89+
}
8490

8591
initialize(options) {
8692
// Avoid race condition: remove previous 'load' listener

0 commit comments

Comments
 (0)