-
-
Notifications
You must be signed in to change notification settings - Fork 28
Open
Description
Bug Description
There is a TypeError occurring when trying to set the cursor property on an undefined object in the application.
Error Details
Uncaught TypeError: Cannot set properties of undefined (setting 'cursor')
at userscript.js:29:28
Root Cause
The error occurs in two locations where the code attempts to set app.store.state.cursor without properly checking if app.store and app.store.state exist:
- src/extension/script.js:20
if (app && (cursor !== null || cursor !== undefined)) {
app.store.state.cursor = cursor; // Error: app.store.state is undefined
}- src/computes.js:197
if(app && (cursor !== null || cursor !== undefined)) {
app.store.state.cursor = cursor; // Error: app.store.state is undefined
}Problem Analysis
While both code blocks check if app exists, they don't verify that app.store or app.store.state are defined before attempting to access them. This can happen when:
- The ZenUML app hasn't fully initialized yet
- The store hasn't been created or is in an invalid state
- There's a timing issue between app creation and message handling
Proposed Solution
Add proper null/undefined checks before setting the cursor:
if (app && app.store && app.store.state && (cursor !== null || cursor !== undefined)) {
app.store.state.cursor = cursor;
}Files Affected
- src/extension/script.js (line 20)
- src/computes.js (line 197)
Impact
This error prevents proper cursor synchronization and may cause the application to fail silently when handling cursor position updates.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels