Skip to content

Latest commit

 

History

History
59 lines (39 loc) · 1.76 KB

TODO.md

File metadata and controls

59 lines (39 loc) · 1.76 KB

Hooks to develop

<RocProvider> and useRoc()

Returns an instance of Roc, initialized with the API URL and database configured at build time.

<RocUserProvider> and useRocUser()

useSample(uuid)

<MainSampleProvider uuid={}> and useMainSample()

Internally calls useSample and permits to access the main sample from anywhere in the children

useMainSampleId()

Tries to get the main sample id from the iframe bridge, or from the query string.

useRocQuery('viewName', options)

Query a CouchDB view. For example useRocQuery('sample_toc') would query https://mydb.cheminfo.org/db/eln/_query/sample_toc

Options examples:

Actions to implement

  • Get an attachment URL by name
  • Save a sample
  • useSampleToc ?
  • handle changes, to know if sample is still unsaved
    • dirty field
    • function to update in-memory copy -> update((draft) => { draft.x = y })
    • function to revert in-memory changes
  • detect server-side change of sample (polling revision id with HEAD ?)
  • re-fetch

Reference: https://github.com/cheminfo-js/visualizer-helper/blob/master/eln/Sample.js

Handle error state

  • All requests
  • No connection
  • Not found
  • No access (unauthenticated for example)

Handle loading state