fix: Error loading share link view.

closes #1143
This commit is contained in:
Tom Moor 2020-01-04 14:02:54 -08:00
parent 7bbddcaebf
commit c1c316b379
1 changed files with 2 additions and 2 deletions

View File

@ -9,13 +9,13 @@ class KeyedDocument extends React.Component<*> {
}
render() {
const { match } = this.props;
const { documentSlug } = this.props.match.params;
// the urlId portion of the url does not include the slugified title
// 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 = match.params.documentSlug.split('-')[1];
const urlId = documentSlug ? documentSlug.split('-')[1] : undefined;
return <DataLoader key={urlId} {...this.props} />;
}