Skip to content

Commit 02f51af

Browse files
committed
✨ load sketches via URL
1 parent 8fcf653 commit 02f51af

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

client/modules/IDE/pages/MobileIDEView.jsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,18 +82,18 @@ const MobileIDEView = (props) => {
8282
// Force state reset
8383
useEffect(clearPersistedState, []);
8484
useEffect(stopSketch, []);
85-
useEffect(() => getProject(params.project_id), []);
8685

8786
// Load Project
8887
const [currentProjectID, setCurrentProjectID] = useState(null);
8988
useEffect(() => {
89+
if (!username) return;
9090
if (params.project_id && !currentProjectID) {
9191
if (params.project_id !== project.id) {
92-
getProject(params.project_id);
92+
getProject(params.project_id, params.username);
9393
}
9494
}
9595
setCurrentProjectID(params.project_id);
96-
}, [params, project]);
96+
}, [params, project, username]);
9797

9898

9999
return (
@@ -269,7 +269,10 @@ MobileIDEView.propTypes = {
269269

270270
getProject: PropTypes.func.isRequired,
271271
clearPersistedState: PropTypes.func.isRequired,
272-
params: PropTypes.shape({ project_id: PropTypes.string }).isRequired,
272+
params: PropTypes.shape({
273+
project_id: PropTypes.string,
274+
username: PropTypes.string
275+
}).isRequired,
273276
};
274277

275278
function mapStateToProps(state) {

0 commit comments

Comments
 (0)