daml/language-support
Gary Verhaegen ebde049cc6
@daml/react: support for multi-{key,query} streams (#7789)
This follows up on #7066 and exposes the new underlying multi-key and
multi-query stream functions through the React bindings. Following the
same reasoning as in #7066, we therefore deprecate the existing
functions (with no intention of removing them) as they become redundant.

CHANGELOG_BEGIN
* JavaScript Client Libraries: Updated React bindings to expose the
  recent addition of multi-key and multi-query streams in @daml/ledger.
  The singular versions are marked as deprecated as they have become
  redundant.

  The upgrade path for `useStreamQuery` is very straightforward: the
  query factory remains optional, but if specified it should return an
  array of queries instead of a single query. The array may be empty,
  which will return all contracts for that template (similar as not
  passing in a query factory). The return values of `useStreamQuery` and
  `useStreamQueries` are the same type.
  ```
  useStreamQuery(T) --> useStreamQueries(T)
  useStreamQuery(T, () => query, ...) --> useStreamQueries(T, () => [query], ...)
  ```

  The upgrade path for `useStreamFetchByKey` is only slightly more
  involved as the return type of `useStreamFetchByKeys` is a new type
  called `FetchByKeysResult` instead of the existing `FetchResult`.
  `FetchByKeysResult` differs from `FetchResult` in that it contains a
  `contracts` field with an array of contracts instead of a singular
  `contract` field. (It differs from `QueryResult` in that each element of
  the returned array can also be `null`, if there is no corresponding
  active contract.) Call sites can be updated as follows:
  ```
  const {loading, contract} = useStreamFetchByKey(T, () => k, ...);

  -->

  const {loading, contracts} = useStreamFetchByKeys(T, () => [k], ...));
  const contract = contracts[0];
  ```
CHANGELOG_END
2020-10-23 14:40:20 +02:00
..
codegen-common set scalac -Xsource:2.13 -Ypartial-unification globally (#6469) 2020-06-24 16:51:24 -04:00
codegen-main Use com.daml as root package (#5343) 2020-04-05 19:49:57 +02:00
hs/bindings language: daml ledger commands against JSON API (#7700) 2020-10-21 16:32:26 +02:00
java resources: Customizable contexts. (#7678) 2020-10-20 09:26:28 +00:00
scala resources: Customizable contexts. (#7678) 2020-10-20 09:26:28 +00:00
ts @daml/react: support for multi-{key,query} streams (#7789) 2020-10-23 14:40:20 +02:00