interface: re-render reply view properly by modifying locationUrl prop

This commit is contained in:
Logan Allen 2021-03-26 17:07:28 -05:00
parent 9fa768dfe8
commit 58087d45bd
3 changed files with 8 additions and 3 deletions

View File

@ -29,6 +29,8 @@ export function GroupFeed(props) {
const relativePath = (path) => baseUrl + path; const relativePath = (path) => baseUrl + path;
const association = associations.graph[graphPath]; const association = associations.graph[graphPath];
const locationUrl = history.location.pathname;
const graphId = `${graphResource.ship.slice(1)}/${graphResource.name}`; const graphId = `${graphResource.ship.slice(1)}/${graphResource.name}`;
const graph = graphs[graphId]; const graph = graphs[graphId];
@ -70,6 +72,7 @@ export function GroupFeed(props) {
render={(routeProps) => { render={(routeProps) => {
return ( return (
<PostReplies <PostReplies
locationUrl={locationUrl}
baseUrl={baseUrl} baseUrl={baseUrl}
api={api} api={api}
history={history} history={history}

View File

@ -32,6 +32,7 @@ export function GroupHome(props) {
'resource' in metadata.config.group; 'resource' in metadata.config.group;
const graphPath = metadata?.config?.group?.resource; const graphPath = metadata?.config?.group?.resource;
const history = useHistory(); const history = useHistory();
return ( return (

View File

@ -15,7 +15,6 @@ export default class PostReplies extends React.PureComponent {
} }
render() { render() {
let graph = this.props.graph;
const { const {
baseUrl, baseUrl,
api, api,
@ -28,6 +27,8 @@ export default class PostReplies extends React.PureComponent {
const graphResource = resourceFromPath(graphPath); const graphResource = resourceFromPath(graphPath);
const graphId = `${graphResource.ship.slice(1)}/${graphResource.name}`; const graphId = `${graphResource.ship.slice(1)}/${graphResource.name}`;
let graph = this.props.graph;
const shouldRenderFeed = !!graph; const shouldRenderFeed = !!graph;
if (!shouldRenderFeed) { if (!shouldRenderFeed) {
@ -39,7 +40,7 @@ export default class PostReplies extends React.PureComponent {
} }
const locationUrl = const locationUrl =
history.location.pathname.replace(`${baseUrl}/feed`, ''); this.props.locationUrl.replace(`${baseUrl}/feed`, '');
let nodeIndex = locationUrl.split('/').slice(1).map((ind) => { let nodeIndex = locationUrl.split('/').slice(1).map((ind) => {
return bigInt(ind); return bigInt(ind);
}); });
@ -64,7 +65,7 @@ export default class PostReplies extends React.PureComponent {
if (!first) { if (!first) {
return ( return (
<Col <Col
key={0} key={locationUrl}
width="100%" width="100%"
height="100%" height="100%"
alignItems="center" overflowY="scroll"> alignItems="center" overflowY="scroll">