Skip to content

Fix TypeError when importing JSON graph without settings property#3100

Merged
lvca merged 2 commits intomainfrom
copilot/fix-json-import-error
Jan 9, 2026
Merged

Fix TypeError when importing JSON graph without settings property#3100
lvca merged 2 commits intomainfrom
copilot/fix-json-import-error

Conversation

Copy link
Contributor

Copilot AI commented Jan 9, 2026

What does this PR do?

Fixes TypeError: Cannot read properties of undefined (reading 'graphSpacing') when importing JSON graph files that lack a settings property.

Motivation

Studio's graph import blindly assigns globalGraphSettings = globalResultset.settings, causing globalGraphSettings to become undefined when the imported JSON lacks settings. This breaks renderGraph() which accesses globalGraphSettings.graphSpacing.

Related issues

Related to graph import functionality in Studio.

Additional Notes

Change: Added conditional check in studio-graph.js:

if (globalResultset.settings) {
  globalGraphSettings = globalResultset.settings;
  delete globalResultset.settings;
}

Also removed duplicate renderGraph() call outside switch statement.

Impact:

  • Preserves default settings when importing JSON without settings
  • Maintains backward compatibility with JSON exports containing settings
  • Single file changed, 4 lines modified

Checklist

  • I have run the build using mvn clean package command
  • My unit tests cover both failure and success scenarios

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • scarf.sh
    • Triggering command: /usr/local/bin/node node ./report.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Importing JSON graph into new DB causes Uncaught TypeError in studio-graph-widget.js</issue_title>
<issue_description>### Reproduce

  1. Create a new DB
  2. Click on Graph tab
  3. Click on Import - > JSON
  4. On the Import Graph dialog click the button Choose File (see attached JSON file nms_recipes_full.zip)
  5. Select a JSON file from your filesystem
  6. Notice the lower portion of dialog says in green color "The file has been uploaded successfully".
  7. Now click on Import the graph at the bottom of dialog
  8. After about 8 secs (because I think the JSON file is being parsed?) the Edge browser JS console shows the error:
studio-graph-widget.js:10  Uncaught TypeError: Cannot read properties of undefined (reading 'graphSpacing')
    at renderGraph (studio-graph-widget.js:10:46)
    at HTMLButtonElement.<anonymous> (studio-graph.js:74:9)
    at HTMLButtonElement.dispatch (jquery.min.js:2:39683)
    at v.handle (jquery.min.js:2:37674)

nms_recipes_full.zip

Environment

Windows 11 Pro, 64GB
WSL with Docker Desktop integrated
From WSL (Arch Linux), I started ArcadeDB via docker with the following:

 docker run --rm -p 2480:2480 -p 2424:2424 \
  -e JAVA_OPTS="-Darcadedb.server.rootPassword=playwithdata \
  -Darcadedb.server.defaultDatabases=Imported[root]{import:https://github.com/ArcadeData/arcadedb-datasets/raw/main/orientdb/OpenBeer.gz}" \
  arcadedata/arcadedb:latest
Unable to find image 'arcadedata/arcadedb:latest' locally
latest: Pulling from arcadedata/arcadedb
9824c27679d3: Pull complete
4f4fb700ef54: Pull complete
60fa98de8c5a: Pull complete
a2ba33acdd26: Pull complete
8988afcd1754: Pull complete
960c5713500a: Pull complete
d4d23bb5eb8f: Pull complete
1d6b833dcea3: Pull complete
5981b8e04f3a: Pull complete
c0c8249855a3: Download complete
Digest: sha256:a5362a094001f1c4d30a9dbb346e07f93a678b0709b4cf17f39be119ef9ddc85
Status: Downloaded newer image for arcadedata/arcadedb:latest

 █████╗ ██████╗  ██████╗ █████╗ ██████╗ ███████╗██████╗ ██████╗
██╔══██╗██╔══██╗██╔════╝██╔══██╗██╔══██╗██╔════╝██╔══██╗██╔══██╗
███████║██████╔╝██║     ███████║██║  ██║█████╗  ██║  ██║██████╔╝
██╔══██║██╔══██╗██║     ██╔══██║██║  ██║██╔══╝  ██║  ██║██╔══██╗
██║  ██║██║  ██║╚██████╗██║  ██║██████╔╝███████╗██████╔╝██████╔╝
╚═╝  ╚═╝╚═╝  ╚═╝ ╚═════╝╚═╝  ╚═╝╚═════╝ ╚══════╝╚═════╝ ╚═════╝
PLAY WITH DATA                                    arcadedb.com\n
WARNING: Using incubator modules: jdk.incubator.vector

2026-01-08 10:24:14.524 INFO  [ArcadeDBServer] <ArcadeDB_0> ArcadeDB Server v26.1.1-SNAPSHOT (build 1ee88b7d030a1e5bc17a35c61e5d7426f856eb40/1767823831033/main) is starting up...
2026-01-08 10:24:14.528 INFO  [ArcadeDBServer] <ArcadeDB_0> Running on Linux 6.6.87.2-microsoft-standard-WSL2 - OpenJDK 64-Bit Server VM 21.0.8 (Temurin-21.0.8+9)
2026-01-08 10:24:14.531 INFO  [ArcadeDBServer] <ArcadeDB_0> Starting ArcadeDB Server in development mode with plugins [] ...
2026-01-08 10:24:14.580 INFO  [ArcadeDBServer] <ArcadeDB_0> - Metrics Collection Started...

Screenshot

Image</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Fix TypeError when importing JSON graph into new DB Fix TypeError when importing JSON graph without settings property Jan 9, 2026
Copilot AI requested a review from lvca January 9, 2026 19:13
@lvca lvca marked this pull request as ready for review January 9, 2026 19:17
@lvca lvca merged commit bd45606 into main Jan 9, 2026
9 of 12 checks passed
@mergify
Copy link
Contributor

mergify bot commented Jan 9, 2026

🧪 CI Insights

Here's what we observed from your CI run for 53e3357.

🟢 All jobs passed!

But CI Insights is watching 👀

@codacy-production
Copy link

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
+0.24%
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (e313118) 76413 49655 64.98%
Head commit (53e3357) 76413 (+0) 49838 (+183) 65.22% (+0.24%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#3100) 0 0 ∅ (not applicable)

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

robfrank pushed a commit that referenced this pull request Feb 11, 2026
)

* Initial plan

* Fix JSON graph import TypeError when settings property is missing

Co-authored-by: lvca <[email protected]>

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: lvca <[email protected]>
(cherry picked from commit bd45606)
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

Successfully merging this pull request may close these issues.

Importing JSON graph into new DB causes Uncaught TypeError in studio-graph-widget.js

2 participants