Skip to content

Commit 7d49e0d

Browse files
committed
fix(annotator): prevent PDF highlight crash on deleted collapsed comments
1 parent 6f3de56 commit 7d49e0d

5 files changed

Lines changed: 34 additions & 4 deletions

File tree

frontend/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/src/components/annotator/pdfViewer/Highlights.vue

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ export default {
120120
commentStates(newVal, oldVal) {
121121
newVal.filter(s => !oldVal.includes(s)).forEach(state => {
122122
const annotation = this.getAnnotationByCommentState(state);
123+
if (!annotation) return;
123124
const annotationPage = annotation?.selectors?.target?.[0]?.selector?.find(s => s.type === 'PagePositionSelector').number;
124125
const isCollapsed = this.collapsedAnnotationIds.includes(annotation.id);
125126
const isPageLoaded = this.isPdfPageLoaded(annotationPage);
@@ -518,9 +519,10 @@ export default {
518519
return textNodes;
519520
},
520521
getAnnotationByCommentState(state) {
521-
let comment = this.$store.getters['table/comment/get'](state.commentId);
522-
let annotation = this.$store.getters['table/annotation/get'](comment.annotationId);
523-
return annotation;
522+
const comment = this.$store.getters['table/comment/get'](state.commentId);
523+
if (!comment) return null;
524+
const annotation = this.$store.getters['table/annotation/get'](comment.annotationId);
525+
return annotation || null;
524526
},
525527
}
526528
}

logs/activity-2026-03-17.log

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{"caller":{"column":25,"file":"Server.js","filePath":"/content-server/backend/webserver/Server.js","function":"Server.<anonymous>","line":468},"level":"info","message":"Server started on port 3001","service":"webServer","timestamp":"2026-03-17T13:40:35.673Z"}
2+
{"caller":{"column":21,"file":"RPC.js","filePath":"/content-server/backend/webserver/RPC.js","function":"MoodleRPC.init","line":41},"level":"info","message":"Connect to RPC server at ws://moodle_rpc:3011","service":"RPC/MoodleRPC","timestamp":"2026-03-17T13:40:35.725Z"}
3+
{"caller":{"column":21,"file":"RPC.js","filePath":"/content-server/backend/webserver/RPC.js","function":"MoodleRPC.init","line":44},"level":"info","message":"RPC initialized","service":"RPC/MoodleRPC","timestamp":"2026-03-17T13:40:35.727Z"}
4+
{"caller":{"column":21,"file":"RPC.js","filePath":"/content-server/backend/webserver/RPC.js","function":"PDFRPC.init","line":41},"level":"info","message":"Connect to RPC server at ws://127.0.0.1:3012","service":"RPC/PDFRPC","timestamp":"2026-03-17T13:40:35.732Z"}
5+
{"caller":{"column":21,"file":"RPC.js","filePath":"/content-server/backend/webserver/RPC.js","function":"PDFRPC.init","line":44},"level":"info","message":"RPC initialized","service":"RPC/PDFRPC","timestamp":"2026-03-17T13:40:35.733Z"}
6+
{"caller":{"column":21,"file":"RPC.js","filePath":"/content-server/backend/webserver/RPC.js","function":"RPCtest.init","line":41},"level":"info","message":"Connect to RPC server at ws://rpc_test:3010","service":"RPC/RPCtest","timestamp":"2026-03-17T13:40:35.736Z"}
7+
{"caller":{"column":21,"file":"RPC.js","filePath":"/content-server/backend/webserver/RPC.js","function":"RPCtest.init","line":44},"level":"info","message":"RPC initialized","service":"RPC/RPCtest","timestamp":"2026-03-17T13:40:35.739Z"}
8+
{"caller":{"column":21,"file":"Service.js","filePath":"/content-server/backend/webserver/Service.js","function":"BackgroundTaskService.init","line":31},"level":"info","message":"Service initialized","service":"Service/BackgroundTaskService","timestamp":"2026-03-17T13:40:35.569Z"}
9+
{"caller":{"column":29,"file":"Server.js","filePath":"/content-server/backend/webserver/Server.js","function":"#initMailServer","line":140},"level":"info","message":"Using sendmail transport","service":"webServer","timestamp":"2026-03-17T13:40:36.191Z"}
10+
{"caller":{"column":29,"file":"Server.js","filePath":"/content-server/backend/webserver/Server.js","function":"anonymous","line":102},"level":"info","message":"Mail server initialized","service":"webServer","timestamp":"2026-03-17T13:40:36.225Z"}
11+
{"level":"info","message":"pg_stat_activity snapshot","pg_stat_activity":{"collectedAt":"2026-03-17T13:40:36.311Z","counts":{"active":5,"idle":5,"total":18},"dbStats":{"blk_read_time":0,"blk_write_time":0,"blks_hit":5526,"blks_read":345,"cache_hit_pct":94.12,"commits":25,"datname":"care","deadlocks":0,"rollback_pct":0,"rollbacks":0,"temp_bytes":0,"temp_files":0,"tup_deleted":0,"tup_fetched":3581,"tup_inserted":0,"tup_returned":5855,"tup_updated":0},"intervalMs":300000,"locks":{"byMode":[{"count":5,"mode":"AccessShareLock"},{"count":2,"mode":"ExclusiveLock"}],"total":7,"waiting":0,"waitingSamples":[]},"oldestActive":[],"sequelizePool":{"available":0,"max":45,"min":0,"size":10,"using":8,"waiting":1}},"service":"webServer","timestamp":"2026-03-17T13:40:36.314Z"}
12+
{"caller":{"column":25,"file":"nlp.js","filePath":"/content-server/backend/webserver/services/nlp.js","function":"Socket.<anonymous>","line":119},"level":"info","message":"Connection to NLP server established: true","service":"Service/NLPService","timestamp":"2026-03-17T13:40:36.513Z"}
13+
{"level":"info","message":"pg_stat_activity snapshot","pg_stat_activity":{"collectedAt":"2026-03-17T13:45:42.096Z","counts":{"active":1,"idle":0,"total":9},"dbStats":{"blk_read_time":0,"blk_write_time":0,"blks_hit":16474,"blks_read":429,"cache_hit_pct":97.46,"commits":137,"datname":"care","deadlocks":0,"rollback_pct":0,"rollbacks":0,"temp_bytes":0,"temp_files":0,"tup_deleted":0,"tup_fetched":13090,"tup_inserted":12,"tup_returned":21195,"tup_updated":0},"intervalMs":300000,"locks":{"byMode":[{"count":1,"mode":"ExclusiveLock"},{"count":1,"mode":"AccessShareLock"}],"total":2,"waiting":0,"waitingSamples":[]},"oldestActive":[],"sequelizePool":{"available":1,"max":45,"min":0,"size":1,"using":0,"waiting":0}},"service":"webServer","timestamp":"2026-03-17T13:45:42.096Z"}
14+
{"level":"info","message":"pg_stat_activity snapshot","pg_stat_activity":{"collectedAt":"2026-03-17T13:50:48.796Z","counts":{"active":1,"idle":0,"total":9},"dbStats":{"blk_read_time":0,"blk_write_time":0,"blks_hit":18035,"blks_read":429,"cache_hit_pct":97.68,"commits":155,"datname":"care","deadlocks":0,"rollback_pct":0,"rollbacks":0,"temp_bytes":0,"temp_files":0,"tup_deleted":0,"tup_fetched":14112,"tup_inserted":13,"tup_returned":28339,"tup_updated":0},"intervalMs":300000,"locks":{"byMode":[{"count":1,"mode":"ExclusiveLock"},{"count":1,"mode":"AccessShareLock"}],"total":2,"waiting":0,"waitingSamples":[]},"oldestActive":[],"sequelizePool":{"available":1,"max":45,"min":0,"size":1,"using":0,"waiting":0}},"service":"webServer","timestamp":"2026-03-17T13:50:48.796Z"}

logs/complete-2026-03-17.log

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{"caller":{"column":25,"file":"Server.js","filePath":"/content-server/backend/webserver/Server.js","function":"Server.<anonymous>","line":468},"level":"info","message":"Server started on port 3001","service":"webServer","timestamp":"2026-03-17T13:40:35.673Z"}
2+
{"caller":{"column":21,"file":"RPC.js","filePath":"/content-server/backend/webserver/RPC.js","function":"MoodleRPC.init","line":41},"level":"info","message":"Connect to RPC server at ws://moodle_rpc:3011","service":"RPC/MoodleRPC","timestamp":"2026-03-17T13:40:35.725Z"}
3+
{"caller":{"column":21,"file":"RPC.js","filePath":"/content-server/backend/webserver/RPC.js","function":"MoodleRPC.init","line":44},"level":"info","message":"RPC initialized","service":"RPC/MoodleRPC","timestamp":"2026-03-17T13:40:35.727Z"}
4+
{"caller":{"column":21,"file":"RPC.js","filePath":"/content-server/backend/webserver/RPC.js","function":"PDFRPC.init","line":41},"level":"info","message":"Connect to RPC server at ws://127.0.0.1:3012","service":"RPC/PDFRPC","timestamp":"2026-03-17T13:40:35.732Z"}
5+
{"caller":{"column":21,"file":"RPC.js","filePath":"/content-server/backend/webserver/RPC.js","function":"PDFRPC.init","line":44},"level":"info","message":"RPC initialized","service":"RPC/PDFRPC","timestamp":"2026-03-17T13:40:35.733Z"}
6+
{"caller":{"column":21,"file":"RPC.js","filePath":"/content-server/backend/webserver/RPC.js","function":"RPCtest.init","line":41},"level":"info","message":"Connect to RPC server at ws://rpc_test:3010","service":"RPC/RPCtest","timestamp":"2026-03-17T13:40:35.736Z"}
7+
{"caller":{"column":21,"file":"RPC.js","filePath":"/content-server/backend/webserver/RPC.js","function":"RPCtest.init","line":44},"level":"info","message":"RPC initialized","service":"RPC/RPCtest","timestamp":"2026-03-17T13:40:35.739Z"}
8+
{"caller":{"column":21,"file":"Service.js","filePath":"/content-server/backend/webserver/Service.js","function":"BackgroundTaskService.init","line":31},"level":"info","message":"Service initialized","service":"Service/BackgroundTaskService","timestamp":"2026-03-17T13:40:35.569Z"}
9+
{"caller":{"column":29,"file":"Server.js","filePath":"/content-server/backend/webserver/Server.js","function":"#initMailServer","line":140},"level":"info","message":"Using sendmail transport","service":"webServer","timestamp":"2026-03-17T13:40:36.191Z"}
10+
{"caller":{"column":29,"file":"Server.js","filePath":"/content-server/backend/webserver/Server.js","function":"anonymous","line":102},"level":"info","message":"Mail server initialized","service":"webServer","timestamp":"2026-03-17T13:40:36.225Z"}
11+
{"level":"info","message":"pg_stat_activity snapshot","pg_stat_activity":{"collectedAt":"2026-03-17T13:40:36.311Z","counts":{"active":5,"idle":5,"total":18},"dbStats":{"blk_read_time":0,"blk_write_time":0,"blks_hit":5526,"blks_read":345,"cache_hit_pct":94.12,"commits":25,"datname":"care","deadlocks":0,"rollback_pct":0,"rollbacks":0,"temp_bytes":0,"temp_files":0,"tup_deleted":0,"tup_fetched":3581,"tup_inserted":0,"tup_returned":5855,"tup_updated":0},"intervalMs":300000,"locks":{"byMode":[{"count":5,"mode":"AccessShareLock"},{"count":2,"mode":"ExclusiveLock"}],"total":7,"waiting":0,"waitingSamples":[]},"oldestActive":[],"sequelizePool":{"available":0,"max":45,"min":0,"size":10,"using":8,"waiting":1}},"service":"webServer","timestamp":"2026-03-17T13:40:36.314Z"}
12+
{"caller":{"column":25,"file":"nlp.js","filePath":"/content-server/backend/webserver/services/nlp.js","function":"Socket.<anonymous>","line":119},"level":"info","message":"Connection to NLP server established: true","service":"Service/NLPService","timestamp":"2026-03-17T13:40:36.513Z"}
13+
{"level":"info","message":"pg_stat_activity snapshot","pg_stat_activity":{"collectedAt":"2026-03-17T13:45:42.096Z","counts":{"active":1,"idle":0,"total":9},"dbStats":{"blk_read_time":0,"blk_write_time":0,"blks_hit":16474,"blks_read":429,"cache_hit_pct":97.46,"commits":137,"datname":"care","deadlocks":0,"rollback_pct":0,"rollbacks":0,"temp_bytes":0,"temp_files":0,"tup_deleted":0,"tup_fetched":13090,"tup_inserted":12,"tup_returned":21195,"tup_updated":0},"intervalMs":300000,"locks":{"byMode":[{"count":1,"mode":"ExclusiveLock"},{"count":1,"mode":"AccessShareLock"}],"total":2,"waiting":0,"waitingSamples":[]},"oldestActive":[],"sequelizePool":{"available":1,"max":45,"min":0,"size":1,"using":0,"waiting":0}},"service":"webServer","timestamp":"2026-03-17T13:45:42.096Z"}
14+
{"level":"info","message":"pg_stat_activity snapshot","pg_stat_activity":{"collectedAt":"2026-03-17T13:50:48.796Z","counts":{"active":1,"idle":0,"total":9},"dbStats":{"blk_read_time":0,"blk_write_time":0,"blks_hit":18035,"blks_read":429,"cache_hit_pct":97.68,"commits":155,"datname":"care","deadlocks":0,"rollback_pct":0,"rollbacks":0,"temp_bytes":0,"temp_files":0,"tup_deleted":0,"tup_fetched":14112,"tup_inserted":13,"tup_returned":28339,"tup_updated":0},"intervalMs":300000,"locks":{"byMode":[{"count":1,"mode":"ExclusiveLock"},{"count":1,"mode":"AccessShareLock"}],"total":2,"waiting":0,"waitingSamples":[]},"oldestActive":[],"sequelizePool":{"available":1,"max":45,"min":0,"size":1,"using":0,"waiting":0}},"service":"webServer","timestamp":"2026-03-17T13:50:48.796Z"}

logs/error-2026-03-17.log

Whitespace-only changes.

0 commit comments

Comments
 (0)