docview becoming inactive again after new note creation

Issue #1 resolved
Christian Scholz
repo owner created an issue

Enter a new note title in the search field and press enter.

Editor shows up shortly but is replaced again by "No Note selected".

Here the debug prints: {{{

creating new document with title: neucbdjhbcs XHR finished loading: "http://localhost:8999/create?title=neucbdjhbcs". show setting content focusing on docview focus on docview XHR finished loading: "http://localhost:8999/q?s=neucbdjhbcs". focusing on searchview selection cleared hide focusing on docview focus on docview saving document XHR finished loading: "http://localhost:8999/uid/null". }}}

Comments (3)

  1. Christian Scholz reporter

    Log flow:

    Method flow:

    • datamodel.loadDocument()
    • datamodel.createDocument() - calls AJAX and triggers:
    • docview.displayNewDocument()
    • - shows new document as editor (prints show)
    • datamodel.update() - refresh the table

    Here AJAX happens while the flow goes on:

    • datamodel.update() just refers to, update_success), the latter is the callback to use
    • starts an AJAX request with callback datamodel.update_success() but the callback is not used!!! Instead search_success is always used!
    • searchfield.focus() - focus search field (maybe a problem)
    • searchresults.update() - update the table contents
    • docview.on_selection_cleared() - let the docview do whatever it needs if the selection is cleared (problem here: should be on the new item)
    • on_selection_cleared() will remove the docview and set the UID to null! This resets the document to be viewed
    • this also saves it to uid/null!
    • datamodel.focus() - focus on the right element!

    Here is the rest of the flow after update() which might run concurrently to the AJAX request:

    • docview.focus() - focus the editor
  2. Log in to comment