File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ import Editor from './Editor';
1818
1919type 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) ;
4446const 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
You can’t perform that action at this time.
0 commit comments