fix: disable share feature on component unmount (#1048)
* fix: disable share feature on component unmount * chore: make sure useEffect run only once Co-authored-by: Leangseu Kim <lkim@edx.org>
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import React from 'react';
|
||||
import { PropTypes } from 'prop-types';
|
||||
import { useIntl } from '@edx/frontend-platform/i18n';
|
||||
import { TwitterShareButton, TwitterIcon } from 'react-share';
|
||||
@@ -19,6 +20,10 @@ const ShareTwitterIcon = () => (
|
||||
function ShareButton({ url }) {
|
||||
const { formatMessage } = useIntl();
|
||||
|
||||
React.useEffect(() => () => {
|
||||
window.expSocialShareEnabled = false;
|
||||
}, []);
|
||||
|
||||
const twitterUrl = stringifyUrl({
|
||||
url,
|
||||
query: {
|
||||
|
||||
Reference in New Issue
Block a user