isographlabs / isograph

The UI framework for teams that move fast — without breaking things.
MIT License
245 stars 16 forks source link

Readable interface #274

Open rbalicki2 opened 2 days ago

rbalicki2 commented 2 days ago

Depends on #273.

I think all things that can be read, which might just be fragment references, but could also be other things, should probably implement the following interface:

interface Readable<T> {
  read(): T,
  readButDoNotSuspend(): { kind: 'Pending' } | { kind: 'Value', value: T }
}

and we should only encounter fragment references as items of this interface, not as concrete fragment references.

All APIs (e.g. useResult, FragmentReader, etc.) should accept items of this interface, not fragment references directly.