LivelyKernel / LivelyKernel/lively.next
this.world() returning null
- Dominant language
- JavaScript
- Stars
- 90
- Forks
- 20
- PR merge metrics
- No merged PRs in 30d
Description
**What would you like to achieve?**
I was debugging with the console when I saw the error:
```
Uncaught (in promise) TypeError: Cannot read properties of null (reading 'halos')
at DashboardControl.DashboardControl_slideIn_ (side-bar.cp.js:387:21)
```
The code was here:
```
$world.execCommand("open browser", {moduleName: "studio/side-bar.cp.js", packageName: "engageLively--galyleo-dashboard", codeEntity: "slideOut"});
```
And here:
```
$world.execCommand("open browser", {moduleName: "studio/side-bar.cp.js", packageName: "engageLively--galyleo-dashboard", codeEntity: "slideIn"});
```
The offending line was:
```
world.halos().forEach(h => h.maskBounds = world.getHaloMask());
```
`world` was null, and it had been set a few lines before with `world = this.world()`.
I fixed it by wrapping it in a null check, but I guess the author of the original code (@merryman ) thought that `this.world()` couldn't be `null`, so I wanted to check if there was a deeper issue.
**How are you trying to achieve that**
**Alternative solutions**
If applicable, what other solutions have you tried?
**Additional Resources**
Please provide links to any custom code that might be necessary to grasp your problem. Screenshots of custom component, etc. are also appreciated.
**Version**: Please paste the lively.next commit on which the problem occurred here (use the copy button of the Version Checker in the bottom left corner).
c725a776b26bd744331765a4881ba4c0557d2fea
Contributor guide
Research direction
Start with studio/side-bar.cp.js at the slideIn and slideOut code paths, especially where this.world() is assigned before world.halos(). Reproduce the null-world error at commit c725a776b26bd744331765a4881ba4c0557d2fea and inspect the surrounding world lifecycle. Done means the dashboard transition no longer dereferences a null world and its intended halo behavior remains intact.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100