Skip to content

Rework visualizer to provide separate views of schema and relationships and update those views - #108

Merged
tstirrat15 merged 11 commits into
mainfrom
rework-visualizer
Feb 13, 2026
Merged

Rework visualizer to provide separate views of schema and relationships and update those views#108
tstirrat15 merged 11 commits into
mainfrom
rework-visualizer

Conversation

@tstirrat15

@tstirrat15 tstirrat15 commented Feb 11, 2026

Copy link
Copy Markdown
Contributor

Fixes #98

Description

We've gotten feedback that the schema visualizer is hard to grok and follow and doesn't provide a ton of value. This is an attempt at reworking it to make it more useful.

TODO

These are bugs that aren't solved by this PR, but will be solved in future work/issues:

  • self edges render behind the node
  • multiple edges on the relationship need a display similar to the schema edge

Previous functionality that was removed, which may or may not be re-added in the future:

  • a two-way binding between highlighting nodes/edges and highlighting elements of the schemas and relationships

Changes

Will annotate.

Testing

Review. Click around in the UI and see that it updates/behaves as expected.

@vercel

vercel Bot commented Feb 11, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
playground Ready Ready Preview, Comment Feb 13, 2026 7:23pm

Request Review


import { PanelProps } from "./base/common";

declare module "@tanstack/react-router" {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed the history state binding, so this went away.

}
}

const useStyles = makeStyles((theme: Theme) =>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Styling is tailwind now

RESOURCE_ID_REGEX,
SUBJECT_ID_REGEX,
} from "../../parsing";
} from "@/spicedb-common/parsing";

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved these components, so I updated their imports to be non-relative

<EdgeLabelRenderer>
<div
style={{
position: "absolute",

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to make these use tailwind instead.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had a go at making these use native tooltip behavior, but react-flow is using a canvas which makes shadcn tooltip stuff less useful, and the tooltip functionality built into react-flow doesn't look as good imo

Comment on lines +225 to +227
const handleMouseMove = useCallback((event: React.MouseEvent) => {
setMousePosition({ x: event.clientX, y: event.clientY });
}, []);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a little worried this will have performance implications but I can't say how it'll manifest off the top of my head.


const definitions = useMemo(
() =>
schema.definitions.filter((def): def is ParsedObjectDefinition => def.kind === "objectDef"),

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't know that you could inline a type assertion like this - TIL

Comment thread src/playground-ui/visjs-network.d.ts Outdated

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything based on visjs has been removed

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure why this was ever in here

Comment thread index.html
<!doctype html>
<html lang="en">
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vis/4.21.0/vis.min.js"></script>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Getting rid of the visjs include

{/* Toggle for view mode */}
<div className="absolute top-4 left-4 z-10 bg-background rounded-md shadow-sm">
<ToggleGroup value={viewMode} variant="outline" type="single" onValueChange={setViewMode}>
<ToggleGroupItem value="relationships" title="Relationship Graph">

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These two buttons could use cursor: pointer.

alecmerdler
alecmerdler previously approved these changes Feb 13, 2026

@alecmerdler alecmerdler left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really nice

alecmerdler
alecmerdler previously approved these changes Feb 13, 2026
@tstirrat15
tstirrat15 merged commit 5aabc9d into main Feb 13, 2026
5 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Feb 13, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Modify the visualizer to display the written relationships instead of the abstract structure of the schema

2 participants