✨ load sketches via URL
This commit is contained in:
parent
8fcf6533d3
commit
02f51afde8
1 changed files with 7 additions and 4 deletions
|
@ -82,18 +82,18 @@ const MobileIDEView = (props) => {
|
||||||
// Force state reset
|
// Force state reset
|
||||||
useEffect(clearPersistedState, []);
|
useEffect(clearPersistedState, []);
|
||||||
useEffect(stopSketch, []);
|
useEffect(stopSketch, []);
|
||||||
useEffect(() => getProject(params.project_id), []);
|
|
||||||
|
|
||||||
// Load Project
|
// Load Project
|
||||||
const [currentProjectID, setCurrentProjectID] = useState(null);
|
const [currentProjectID, setCurrentProjectID] = useState(null);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
if (!username) return;
|
||||||
if (params.project_id && !currentProjectID) {
|
if (params.project_id && !currentProjectID) {
|
||||||
if (params.project_id !== project.id) {
|
if (params.project_id !== project.id) {
|
||||||
getProject(params.project_id);
|
getProject(params.project_id, params.username);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
setCurrentProjectID(params.project_id);
|
setCurrentProjectID(params.project_id);
|
||||||
}, [params, project]);
|
}, [params, project, username]);
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -269,7 +269,10 @@ MobileIDEView.propTypes = {
|
||||||
|
|
||||||
getProject: PropTypes.func.isRequired,
|
getProject: PropTypes.func.isRequired,
|
||||||
clearPersistedState: PropTypes.func.isRequired,
|
clearPersistedState: PropTypes.func.isRequired,
|
||||||
params: PropTypes.shape({ project_id: PropTypes.string }).isRequired,
|
params: PropTypes.shape({
|
||||||
|
project_id: PropTypes.string,
|
||||||
|
username: PropTypes.string
|
||||||
|
}).isRequired,
|
||||||
};
|
};
|
||||||
|
|
||||||
function mapStateToProps(state) {
|
function mapStateToProps(state) {
|
||||||
|
|
Loading…
Reference in a new issue