Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Components not loading in frozen world #201

Open
rickmcgeer opened this issue Dec 11, 2024 · 2 comments
Open

Components not loading in frozen world #201

rickmcgeer opened this issue Dec 11, 2024 · 2 comments
Assignees

Comments

@rickmcgeer
Copy link
Contributor

I recently rebuilt Galyleo studio, for the first time in a number of months. It failed to load (it loads just fine in Studio), with the following error message in the console:

app-7690e3e6.js:86534 Uncaught (in promise) TypeError: Cannot read properties of null (reading 'get')
    at GalyleoStudioWorld.GalyleoStudioWorld_withTopBarDo_ (app-7690e3e6.js:86534:60)
    at GalyleoStudioWorld.LivelyWorld_makeDirty_ (app-7690e3e6.js:43005:20)
    at ChangeManager.ChangeManager__record_ (__rootModule___commonjs-entry-6973bbff.js:43233:102)
    at ChangeManager.ChangeManager_addValueChange_ (__rootModule___commonjs-entry-6973bbff.js:43197:25)
    at GalyleoStudioWorld.Morph_addValueChange_ (__rootModule___commonjs-entry-6973bbff.js:51788:43)
    at GalyleoStudioWorld.Morph_setProperty_ (__rootModule___commonjs-entry-6973bbff.js:51544:25)
    at GalyleoStudioWorld.defaultSetter (__rootModule___commonjs-entry-6973bbff.js:53839:22)
    at GalyleoStudioWorld.setter [as morphCommentMap] (__rootModule___commonjs-entry-6973bbff.js:4448:31)
    at GalyleoStudioWorld.initialize (app-7690e3e6.js:46059:40)
    at Object.prepareInstanceForProperties (__rootModule___commonjs-entry-6973bbff.js:4627:41)

As I traced the code, this is the function that is throwing the exception:

$world.execCommand("open browser", {moduleName: "studio/ui.cp.js", packageName: "engageLively--galyleo-dashboard", codeEntity: [{"name":"GalyleoStudioWorld","type":"class-decl"},{"name":"withTopBarDo","type":"class-instance-method"}]});

And it appears (tracing the code further up the stack) that a new property MorphCommentMap has been added as a default property, and that

$world.execCommand("open browser", {moduleName: "world.js", packageName: "lively.ide", codeEntity: [{"name":"LivelyWorld","type":"class-decl"},{"name":"makeDirty","type":"class-instance-method"}]});

checks to see if the morph needs to be rendered, and if not initiates a withTopBarDo callback, assuming that withTopBarDo hadn't been overridden (as it has in Galyleo).

LivelyWorld.makeDirty is given here:

makeDirty () {
    if (!this.renderingState.needsRerender) {
      this.withTopBarDo(tb => tb.updateMiniMapIfNeeded());
    }
    super.makeDirty();
  }

and the Galyleo version here:

  withTopBarDo (cb) {
    const topBar = this.getSubmorphNamed('dashboard').get('top bar');
    cb(topBar);
  }
@rickmcgeer
Copy link
Contributor Author

We clearly don't need the minimap code, so skipping the callback should be fine. So I tried amending the withTopBarDo code in GalyleoStudioWorld to:

  withTopBarDo (cb) {
    const dashboard =  this.getSubmorphNamed('dashboard').
    if(dashboard)  {
      const topBar = dashboard.get('top bar');
      cb(topBar);
    }
  }

This led to a large number of errors when Lively.world attempted to write the TopBar minimap. This was solved by adding

$world.execCommand("open browser", {moduleName: "studio/top-bar.cp.js", packageName: "engageLively--galyleo-dashboard", codeEntity: [{"name":"GalyleoTopBarModel","type":"class-decl"},{"name":"updateMiniMapIfNeeded","type":"class-instance-method"}]});

to override the default TopBar with:

  updateMiniMapIfNeeded () {
    // just override to prevent errors
  }

@rickmcgeer
Copy link
Contributor Author

Requesting review from @merryman

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants