Hosted onui-with-state-machines.hyper.mediavia theHypermedia Protocol

Notes about how the document machine should worksome unstructured ideas I shared with my coding agent to make sure the document machine is more robust and comply with our needs

here are the events and lifecycles that can update the document content, because the main issue is the main document content:

  • user enters docA

  • we fetch the resource

  • when resolved we load the document in the editor in reading mode (loaded state)

  • when the user that can edit clicks on any element in the content, we transition to edit mode (editing state).

  • from editing the user can enter into publishing state

  • in any state, the user can open the versions history panel and change to view an older version of the document. in this case we need to re-render the document content (document header and document editor content) and render the selected version WITHOUT APPLYING ANY DATA FROM THE CURRENT DOCUMENT DRAFT IF ANY.

  • when viewing an old version of a document, we should PREVENT editing the document by clicking any block inside the content (we should not transition to editing from loaded when rendering an older version).

  • when we press “discard draft” and confirm the action, we should: render the latest document version, delete the current draft for the document, show a toast that the changes where removed.

  • it should not be possible to discard changs if there’s no draft available for the current document.

  • let’s remove the option to start editing the document from an old version of the document.

  • the rebase flow: we should enter rebase ONLY when the current base version gets outdated. this can happen when a new version gets synced to the daemon and the external polling invalidates the useResource result. WE SHOULD NOT REBASE WHILE WE ARE EITHER SABING OR IN ANOTHER REBASE FLOW

  • the rebase check for conflicts should not affect the editing experience.

  • when there's a rebase conflict, for now we should just ignore it, so we can transition to the rebase idle state.

Do you like what you are reading? Subscribe to receive updates.

Unsubscribe anytime