Skip to content

Fixed edited grades in the marks spreadsheet reverting after being saved - #8260

Merged
david-yz-liu merged 5 commits into
MarkUsProject:masterfrom
david-yz-liu:fix-marks-spreadsheet-revert
Nov 6, 2026
Merged

david-yz-liu merged 5 commits into
MarkUsProject:masterfrom
david-yz-liu:fix-marks-spreadsheet-revert

Conversation

@david-yz-liu

@david-yz-liu david-yz-liu commented Nov 2, 2026 •

Copy link
Copy Markdown
Collaborator

Proposed Changes

Fixes a report that, in the marks spreadsheet, a changed grade would flash green (saved) and then revert to its original value a few seconds later. Refreshing the page showed the new grade, so the save had worked.

There were two causes, both in GradeEntryCell:

  1. Stale table data reset the input. After a save, updateTotal updates RawMarksSpreadsheet's data state. However, shouldComponentUpdate doesn't re-render for that change (the row count is unchanged), so react-table keeps the data from page load. GradeEntryCell.componentWillReceiveProps reset the input from props on every re-render, so any re-render react-table makes on its own (e.g. resizing a column) put the original grade back in the cell.
    • Fix: componentWillReceiveProps is replaced with componentDidUpdate, which only resets the input when default_value or student_id changes. The student_id check is needed because react-table keys rows by position, so a cell can be reused for a different student after sorting. This also removes React's deprecation warning for componentWillReceiveProps.
  2. Out-of-order save responses. Typing with pauses longer than the 300 ms debounce sends more than one request (e.g. 2, then 25). If the earlier response arrived last, it overwrote the newer grade in the component's data, and the next re-render showed the older value.
    • Fix: each cell now numbers its save requests and ignores responses to any request that a later edit has replaced.

Type of Change

Type Applies?
🚨 Breaking change (fix or feature that would cause existing functionality to change)
✨ New feature (non-breaking change that adds functionality)
🐛 Bug fix (non-breaking change that fixes an issue) X
🎨 User interface change (change to user interface; provide screenshots)
♻️ Refactoring (internal change to codebase, without changing functionality)
🚦 Test update (change that only adds or modifies tests)
📦 Dependency update (change that updates a dependency)
📖 Documentation update (change that updates documentation)
🔧 Internal (change that only affects developers or continuous integration)

Checklist

Before opening your pull request:

  • I have performed a self-review of my changes.
  • I have added tests for my changes, if applicable.
  • I have updated the project documentation, if applicable.
  • If this is my first contribution, I have added myself to the list of contributors.

After opening your pull request:

  • I have updated the project Changelog (this is required for all changes).
  • I have verified that the pre-commit.ci checks have passed.
  • I have verified that the CI tests have passed.
  • I have reviewed the test coverage changes reported by Coveralls.
  • I have requested a review from a project maintainer.

Questions and Comments

  • If overlapping requests are processed out of order on the server, the saved value could still be the older one. That is much less likely than responses arriving out of order, and this change doesn't address it.
  • GradeEntryTotal uses the same pattern and might briefly show another row's total after an edit followed by a sort. I haven't confirmed this, and it is not changed here.

🤖 Generated with Claude Code

david-yz-liu and others added 2 commits November 2, 2026 18:55
GradeEntryCell reset its input from props on every re-render, but the table
can re-render with stale row data (e.g. when resizing a column), since
RawMarksSpreadsheet.shouldComponentUpdate does not propagate updated grades.
Now the input is only reset when the row's value or student changes.

Also ignore responses to save requests superseded by a later edit of the same
cell, so out-of-order responses no longer overwrite newer grades.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coveralls

coveralls commented Nov 3, 2026 •

Copy link
Copy Markdown
Collaborator

Coverage Report for CI Build 42150147914

Coverage increased (+0.01%) to 91.415%

Details

  • Coverage increased (+0.01%) from the base build.
  • Patch coverage: 6 of 6 lines across 1 file are fully covered (100%).
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 54464
Covered Lines: 50864
Line Coverage: 93.39%
Relevant Branches: 2705
Covered Branches: 1397
Branch Coverage: 51.65%
Branches in Coverage %: Yes
Coverage Strength: 130.08 hits per line

💛 - Coveralls

david-yz-liu and others added 3 commits November 2, 2026 20:14
@david-yz-liu david-yz-liu added this to the v2.10.6 milestone Nov 6, 2026
@david-yz-liu
david-yz-liu merged commit d83cf99 into MarkUsProject:master Nov 6, 2026
9 checks passed
@david-yz-liu
david-yz-liu deleted the fix-marks-spreadsheet-revert branch November 6, 2026 11:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants