Skip to content

Commit 8b102dc

Browse files
author
Ives van Hoorne
committed
Fix Forking + Renaming
1 parent 2c99a7c commit 8b102dc

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/app/pages/Sandbox/index.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import Editor from './Editor';
1818

1919
type Props = {
2020
sandbox: ?Sandbox,
21+
sandboxes: { [id: string]: Sandbox },
2122
sandboxActions: typeof sandboxActions,
2223
match: { url: string, params: { id: ?string } },
2324
};
@@ -35,10 +36,11 @@ const mapStateToProps = createSelector(
3536
if (sandbox) {
3637
return {
3738
sandbox: denormalize(sandbox, sandboxEntity, entities),
39+
sandboxes,
3840
};
3941
}
4042

41-
return { sandbox: null };
43+
return { sandbox: null, sandboxes };
4244
}
4345
);
4446
const mapDispatchToProps = dispatch => ({
@@ -58,8 +60,13 @@ class SandboxPage extends React.PureComponent {
5860
};
5961

6062
componentDidUpdate(oldProps) {
61-
if (this.props.match.params.id !== oldProps.match.params.id) {
62-
this.fetchSandbox();
63+
const newId = this.props.match.params.id;
64+
const oldId = oldProps.match.params.id;
65+
66+
if (newId != null && oldId !== newId) {
67+
if (!this.props.sandboxes[newId]) {
68+
this.fetchSandbox();
69+
}
6370
}
6471
}
6572

0 commit comments

Comments
 (0)