Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Make it easier to use write hooks that involve passing references from preceding write operations

Aperta
#29 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
react, typescript
Ambito
frontend

Direzione di ricerca

Nell’issue non sono identificati file né test. Inizia esaminando i write hook esistenti, l’issue estratta e la pull request #26 per comprendere l’approccio rifiutato; done dovrebbe consentire ai chiamanti di passare allegati alla mutazione dell’osservazione senza concatenare manualmente le operazioni di creazione dei blob.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Extracted from https://github.com/digidem/comapeo-core-react/issues/20

The most notable example of this is when creating/updating observations that have attachments. Right now, the end-user has to work with the relevant write hook to create the attachment(s) prior to creating the observation e.g.

const createBlob = useCreateBlob(...)

const createObservation = useCreateDoc({ docType: 'observation', ... })

// Example of a single attachment
function onPress() {
  createBlob.mutate(..., {
    onSuccess: (blob) => {
      // Create observation that references blob after its creation
      createObservation.mutate({ value: { attachments: [{ ...blob, driveDiscoveryId: blob.driveId }] }, ...})
    }
  })
}

// Example of multiple attachments
function onPress() {
  Promise.all([
    createBlob.mutateAsync(...),
    createBlob.mutateAsync(...),
  ]).then(attachments => {
    // Create observation that has multiple attachments
    createObservation.mutate({ value: { attachments: blobs.map((b) => ({ ...b, driveDiscoveryId: blob.driveId })), ... } })
  })
}

The idea would be to have something similar to what the original issue outlined such that the end-user code could look more like this:

createObservation.mutate({ value: ..., attachmentsToAdd: [...] })

As mentioned in https://github.com/digidem/comapeo-core-react/pull/26, I didn't figure out a satisfactory way of implementing this and decided to leave that as a follow-up, since it's mostly for end-usage convenience.

Lingua principale
TypeScript
Stelle
1
Fork
1
Merge medio
21m
PR unite (30g)
4

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di digidem/comapeo-core-react

Tutte le issue di digidem/comapeo-core-react

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.