Solid Automerge - v3.0.0
    Preparing search index...

    Function mount

    • mount another document on a key of a document projection.

      the mounted document's patches are applied to the projection under key, so parent[key] is a fine-grained live view of the other document, in the same store (snapshot, deep and <For> all see it). whatever the parent document itself has at key is hidden while something is mounted there.

      changing the parent through its handle only changes the parent. to change the mounted document, use its own handle, or write through a mutable view of the parent, which sends writes under key to the mounted document.

      const [folder] = useDocument<Folder>(() => props.url)
      const [readme] = useDocument<Readme>(() => folder.readmeUrl)
      mount(folder, "readme", readme)
      return <h1>{folder.readme.title}</h1>

      Parameters

      • projection: object

        the projection to mount on

      • key: string

        the key to mount the other document on

      • document: Mountable

        a document projection, a handle, or an accessor of one

      Returns () => void

      a function that unmounts it again. it's also unmounted when the owner that called mount is cleaned up