Database Write
The API says saved, but the nickname returns to its old value after refresh. Confirm the write really committed.
The API says saved, but the nickname returns to its old value after refresh. Confirm the write really committed.
The content disappears after refresh because the write did not finish.
Problem and key mechanism: A page showing save success early does not prove the database write completed; after checking input and permission, write the target record and wait for commit before returning the actual result.
How to observe the improvement: Return success only after the write completes, or return the specific failure instead of relying on early local state. After refresh, query with the same id and show the saved nickname.
Publishing grades also requires a confirmed write: After a teacher publishes a grade, the grade record must be written and committed. Reopening the student's grade page and reading the new score confirms the write completed.
The API returns 200 but the old nickname returns after refresh. Trace validation, the database write, commit completion, and response timing, and confirm refresh reads the same record. Fix it, save once, refresh once, and inspect both the database row and API response; do not only change local state.