Post: fix various crashes

This commit is contained in:
Liam Fitzgerald 2021-03-26 13:51:28 +10:00
parent b506eb44eb
commit 45e11204d3
No known key found for this signature in database
GPG Key ID: D390E12C61D1CFFB
2 changed files with 6 additions and 6 deletions

View File

@ -15,7 +15,7 @@ export function GroupFeedHeader(props) {
historyLocation === `${baseUrl}/feed`;
const locationUrl =
history.location.pathname.replace(`${baseUrl}`, '').replace(/^\/[a-z]*/, '');
history.location.pathname.replace(`${baseUrl}`, '').replace(/^\/[a-z|\/]*/, '');
let nodeIndex = locationUrl.split('/').slice(1).map((ind) => {
return bigInt(ind);
});

View File

@ -34,11 +34,11 @@ export class PostFeed extends React.Component {
if (!node || !post) {
return null;
}
let nodeIndex = parentNode ? parentNode.post.index.split('/').slice(1).map((ind) => {
return bigInt(ind);
}) : [];
if (parentNode && index.eq(first ?? bigInt.zero)) {
let nodeIndex = parentNode.post.index.split('/').slice(1).map((ind) => {
return bigInt(ind);
});
return (
<React.Fragment key={index.toString()}>
@ -88,7 +88,7 @@ export class PostFeed extends React.Component {
graphResource={graphResource}
association={association}
api={api}
index={[index]}
index={[...nodeIndex, index]}
baseUrl={baseUrl}
history={history}
parentPost={parentNode?.post}