Skip to content

Commit 069436a

Browse files
authored
Merge pull request #24 from DiamondLightSource/prevent_rerender_on_page_not_in_map
Prevent re-render on screen not in JsonMap
2 parents 2ba5ff5 + 2b4f972 commit 069436a

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "daedalus",
33
"private": true,
4-
"version": "0.0.4",
4+
"version": "0.0.5",
55
"type": "module",
66
"scripts": {
77
"dev": "vite",

src/components/ScreenDisplay.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,9 @@ export default function ScreenDisplay() {
7070
const currentFile = Object.values(allFiles).find(
7171
values => values.file === displayedPath
7272
);
73-
if (currentFile?.urlId !== pathname) {
74-
// URL and state are out of sync with file displayed, update accordingly
73+
74+
if (currentFile?.urlId && currentFile.urlId !== pathname) {
75+
// URL and state are out of sync with file displayed, update accordingly, if currentFile is null this file is not in the JsonMap
7576
navigate(`/synoptic/${state.currentBeamline}/${currentFile?.urlId}`, {
7677
state: location.state,
7778
replace: true

0 commit comments

Comments
 (0)