fix: Blank nodes show no icon on graph canvas but display default icon in ...#1799
Conversation
kmcginnes
left a comment
There was a problem hiding this comment.
Nice fix. Needs a couple small cleanups, but otherwise good.
There was a problem hiding this comment.
This needs to be reverted
There was a problem hiding this comment.
This needs to be reverted
Blank nodes are assigned the synthetic type LABELS.MISSING_TYPE at runtime, but that type is never stored in the schema. As a result useAllVertexPreferences emitted no entry for it and useGraphStyles produced no Cytoscape selector, so blank nodes rendered without an icon on the canvas while the details panel still showed the default icon. Always include a LABELS.MISSING_TYPE entry in useAllVertexPreferences so a node[type="No Type"] selector with the default icon is generated, making canvas rendering consistent with the details panel. Fixes aws#1779
|
Thanks for the review. I have addressed both points.
I also rebased the branch onto the latest Ready for another look when you have a chance. |
|
Thanks for the submission! This looks good. I'm excited to have this fixed. I'll merge it in as soon as the checks pass. |
Description
Blank nodes are assigned the synthetic type
LABELS.MISSING_TYPE(the "No Type" label) at runtime increateVertex()when no types are provided. That type is never stored in the schema, souseAllVertexPreferences()inpackages/graph-explorer/src/core/StateProvider/userPreferences.tsproduced no entry for it anduseGraphStylesgenerated no Cytoscape style selector. As a result blank nodes rendered without an icon on the canvas, while the details panel (which usesuseVertexPreferences(type)) still fell back to the default icon.This change makes
useAllVertexPreferences()always include aLABELS.MISSING_TYPEentry (using default preferences) unless the active schema already contains that type.useGraphStylesthen emits a node style selector carrying the default icon for blank nodes, so the canvas matches the details panel.Validation
useGraphStylesbuilds one node style selector per entry returned byuseAllVertexPreferences(). Adding theMISSING_TYPEentry produces the selector that carries the default icon for blank nodes, which was previously missing. A reviewer can confirm by loading a graph that contains a blank node and checking that its canvas icon now matches the icon shown in the details panel.Related Issues
Fixes #1779
Check List
pnpm checkspasses with no errors.pnpm testpasses with no failures.Notes
The branch has been rebased onto the latest
mainto resolve the merge conflict. Sincemainrefactored this file to type-keyed map atoms (#1867), the fix is reapplied on top of that structure with the same behavior. The earlierpackage.jsonandpnpm-lock.yamlchanges were local toolchain tweaks and have been reverted, so this PR now touches a single file. Thepnpm checksandpnpm coverageboxes are left for CI to verify, since the required Node version for a local run is newer than my local toolchain.AI Assistance Disclosure
I used GitHub Copilot to help prepare this change. I have reviewed and understand it, and I will respond to review feedback.