From b0e15e0cbc445e12e3aabfe90ee2fc6bf2c33782 Mon Sep 17 00:00:00 2001
From: Jacky Zhao <j.zhao2k19@gmail.com>
Date: Mon, 02 May 2022 16:19:26 +0000
Subject: [PATCH] Merge pull request #118 from aidenybai/add-router

---
 assets/js/graph.js |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/assets/js/graph.js b/assets/js/graph.js
index 939fd99..99ecf54 100644
--- a/assets/js/graph.js
+++ b/assets/js/graph.js
@@ -16,9 +16,8 @@
     ...new Set(links.flatMap((link) => [link.source, link.target])),
   ];
 
-  // links is mutated by d3
-  // we want to use links later on, so we make a copy and pass
-  // that one to d3
+  // Links is mutated by d3. We want to use links later on, so we make a copy and pass that one to d3
+  // Note: shallow cloning does not work because it copies over references from the original array
   const copyLinks = JSON.parse(JSON.stringify(links));
 
   const neighbours = new Set();
@@ -176,6 +175,7 @@
     .attr('fill', color)
     .style('cursor', 'pointer')
     .on('click', (_, d) => {
+      // SPA navigation
       window.navigate(
         new URL(`${baseUrl}${decodeURI(d.id).replace(/\s+/g, '-')}/`),
         '.singlePage'

--
Gitblit v1.10.0