Write, edit, resolve, and delete comments on cells, first on a client-only grid, then with a simulated second user, a forced conflict, and an offline switch.
The first grid keeps anonymous comments in the local storage of your browser. It has no user and no server.
Open a cell and press Shift+F2, or right-click and choose Comments…. Comments stay in this browser.
The second grid saves each comment write to an in-memory server with about 400 ms of latency. The server accepts a write only when its baseVersion equals the stored version. Press Shift+F2 on a cell, or right-click a cell and choose "Comments…". A second user, Grace, writes comments through applyRemote.
Open a cell and press Shift+F2, or right-click and choose Comments…
Grace adds a comment sends a change from another client through applyRemote. The comment marker shows without a reload.
Grace edits a comment (force a conflict) changes your first comment on the server. Write a comment first, press the button, and then edit your comment. The server refuses the save as stale, and the popover offers Save my version and Discard.
Go offline makes every save throw. The popover keeps your text and offers Retry.
The server demo passes onCommentSave to call the server, onLocalChange and onCommentRejected to log each result, and getCommentMenuItems to the context menu. For the same wiring in your own app, see Add comments to cells.