File tree Expand file tree Collapse file tree 4 files changed +14
-10
lines changed
app/store/entities/sandboxes/modules Expand file tree Collapse file tree 4 files changed +14
-10
lines changed Original file line number Diff line number Diff line change @@ -8,16 +8,20 @@ function findById(entities, id) {
88 return entities . find ( e => e . id === id ) ;
99}
1010
11+ function findByShortid ( entities , shortid ) {
12+ return entities . find ( e => e . shortid === shortid ) ;
13+ }
14+
1115export const getModulePath = ( modules , directories , id ) => {
1216 const module = findById ( modules , id ) ;
1317
1418 if ( ! module ) return '' ;
1519
16- let directory = findById ( directories , module . directoryShortid ) ;
20+ let directory = findByShortid ( directories , module . directoryShortid ) ;
1721 let path = '/' ;
1822 while ( directory != null ) {
1923 path = `/${ directory . title } ${ path } ` ;
20- directory = findById ( directories , directory . directoryShortid ) ;
24+ directory = findByShortid ( directories , directory . directoryShortid ) ;
2125 }
2226 return path ;
2327} ;
Original file line number Diff line number Diff line change @@ -101,7 +101,7 @@ export default class App extends React.PureComponent {
101101 currentModule : this . state . currentModule ||
102102 response . data . modules . find (
103103 m => m . title === 'index.js' && m . directoryShortid == null ,
104- ) . id ,
104+ ) . shortid ,
105105 } ) ;
106106 } catch ( e ) {
107107 this . setState ( { notFound : true } ) ;
Original file line number Diff line number Diff line change @@ -74,7 +74,7 @@ export default class Content extends React.Component {
7474
7575 const preferences = { livePreviewEnabled : true } ;
7676 const mainModule =
77- sandbox . modules . find ( m => m . id === currentModule ) ||
77+ sandbox . modules . find ( m => m . shortid === currentModule ) ||
7878 sandbox . modules . find (
7979 m => m . title === 'index.js' && m . directoryShortid == null ,
8080 ) ;
Original file line number Diff line number Diff line change @@ -39,9 +39,9 @@ const Files = ({
3939 return (
4040 < Container >
4141 { sortBy ( childrenDirectories , d => d . title ) . map ( d => (
42- < div key = { d . id } >
42+ < div key = { d . shortid } >
4343 < File
44- id = { d . id }
44+ id = { d . shortid }
4545 title = { d . title }
4646 type = "directory"
4747 depth = { depth }
@@ -50,7 +50,7 @@ const Files = ({
5050 < Files
5151 modules = { modules }
5252 directories = { directories }
53- directoryId = { d . id }
53+ directoryId = { d . shortid }
5454 depth = { depth + 1 }
5555 setCurrentModule = { setCurrentModule }
5656 currentModule = { currentModule }
@@ -59,13 +59,13 @@ const Files = ({
5959 ) ) }
6060 { sortBy ( childrenModules , m => m . title ) . map ( m => (
6161 < File
62- id = { m . id }
62+ id = { m . shortid }
6363 title = { m . title }
64- key = { m . id }
64+ key = { m . shortid }
6565 type = "module"
6666 depth = { depth }
6767 setCurrentModule = { setCurrentModule }
68- active = { m . id === currentModule }
68+ active = { m . shortid === currentModule }
6969 alternative = { m . title === 'index.js' && m . directoryShortid == null }
7070 />
7171 ) ) }
You can’t perform that action at this time.
0 commit comments