Skip to content

Commit

Permalink
Reloading github molecules works
Browse files Browse the repository at this point in the history
  • Loading branch information
BarbourSmith committed Jan 10, 2022
1 parent e9f170d commit 4484aab
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/js/githubOauth.js
Original file line number Diff line number Diff line change
Expand Up @@ -1133,7 +1133,7 @@ export default function GitHubModule(){
return jsonData

}catch(err){
console.warn("Unable to load project data from github")
console.warn("Unable to load project data from github...using full model")
return false
}
}
Expand Down
16 changes: 14 additions & 2 deletions src/js/molecules/githubmolecule.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export default class GitHubMolecule extends Molecule {
else{
//Store values that we want to overwrite in the loaded version
var valuesToOverwriteInLoadedVersion
if(this.topLevel){
if(this.topLevel){ //If we are loading this as a stand alone project
valuesToOverwriteInLoadedVersion = {atomType: this.atomType, topLevel: this.topLevel}
}
else{
Expand All @@ -107,14 +107,26 @@ export default class GitHubMolecule extends Molecule {
*/
reloadMolecule(){

var outputConnector = false
if(this.output.connectors.length > 0){
outputConnector = this.output.connectors[0]
}

//Delete everything currently inside...Make a copy to prevent index issues
const copyOfNodesOnTheScreen = [...this.nodesOnTheScreen]
copyOfNodesOnTheScreen.forEach(node => {
node.deleteNode(false, false, true)
})

//Re-serialize this molecule
//Re-de-serialize this molecule
this.loadProjectByID(this.projectID).then( ()=> {

if(outputConnector){
//Reconnect the output connector
outputConnector.attachmentPoint1 = this.output
this.output.connectors.push(outputConnector)
}

this.beginPropagation(true)
this.updateSidebar()
})
Expand Down
2 changes: 1 addition & 1 deletion src/js/prototypes/attachmentpoint.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export default class AttachmentPoint {
*/
this.ready = true
/**
* A list of all of the connectors attached to this attachmet point
* A list of all of the connectors attached to this attachment point
* @type {object}
*/
this.connectors = []
Expand Down

0 comments on commit 4484aab

Please sign in to comment.