EmbeddedStatus: block navigation
This commit is contained in:
parent
54ff81afc6
commit
9fb9523a4e
1 changed files with 6 additions and 0 deletions
|
@ -1,4 +1,5 @@
|
|||
import React, { useEffect, useState } from 'react';
|
||||
import { useHistory } from 'react-router-dom';
|
||||
|
||||
import { fetchStatus } from 'soapbox/actions/statuses';
|
||||
import MissingIndicator from 'soapbox/components/missing_indicator';
|
||||
|
@ -18,10 +19,15 @@ const getStatus = makeGetStatus();
|
|||
/** Status to be presented in an iframe for embeds on external websites. */
|
||||
const EmbeddedStatus: React.FC<IEmbeddedStatus> = ({ params }) => {
|
||||
const dispatch = useAppDispatch();
|
||||
const history = useHistory();
|
||||
const status = useAppSelector(state => getStatus(state, { id: params.statusId }));
|
||||
|
||||
const [loading, setLoading] = useState(true);
|
||||
|
||||
// Prevent navigation for UX and security.
|
||||
// https://stackoverflow.com/a/71531211
|
||||
history.block();
|
||||
|
||||
useEffect(() => {
|
||||
dispatch(fetchStatus(params.statusId))
|
||||
.then(() => setLoading(false))
|
||||
|
|
Loading…
Reference in a new issue