fix: Document gets 'stuck' when navigating between docs with similar slugs

closes #1175
This commit is contained in:
Tom Moor 2020-02-18 20:13:01 -08:00
parent 8daef8ebce
commit 4cb48e7310
1 changed files with 2 additions and 1 deletions

View File

@ -15,7 +15,8 @@ class KeyedDocument extends React.Component<*> {
// we only want to force a re-mount of the document component when the
// document changes, not when the title does so only this portion is used
// for the key.
const urlId = documentSlug ? documentSlug.split('-')[1] : undefined;
const urlParts = documentSlug ? documentSlug.split('-') : [];
const urlId = urlParts.length ? urlParts[urlParts.length - 1] : undefined;
return <DataLoader key={urlId} {...this.props} />;
}