Skip to content

Commit

Permalink
Merge pull request #1424 from NetsBlox/1415-rpc-blocks-lose-types
Browse files Browse the repository at this point in the history
Add (hacky) fallback for getting a ref to the IDE morph in RPC blocks. Fix #1415
  • Loading branch information
brollb authored Sep 26, 2023
2 parents ec7767d + 272b1bd commit 9dd2a33
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/blocks-ext.js
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,8 @@ StructInputSlotMorph.prototype.setContents = function(name, values) {
StructInputSlotMorph.prototype.getFieldValue = function(fieldname, value, meta={}) {
// Input slot is empty or has a string
if (!value || typeof value === 'string') {
const hostUrl = this.parentThatIsA(IDE_Morph)?.services.defaultHost?.url;
const ide = this.parentThatIsA(IDE_Morph) || world?.children[0]; // This fallback isn't an ideal way to get the IDE morph...
const hostUrl = ide?.services.defaultHost?.url;
if (!hostUrl) return new HintInputSlotMorph(value || '', fieldname, false, undefined, false);

// FIXME: support type definitions from other hosts, too
Expand Down

0 comments on commit 9dd2a33

Please sign in to comment.