digital-asset / daml-ui-template

Apache License 2.0
10 stars 14 forks source link

Update Default.js to useStreamQuery #12

Open bartcant opened 4 years ago

bartcant commented 4 years ago

I noticed that Default.Js is using

import { useQuery } from "@daml/react"; ... const assets = useQuery (Main.Asset);

This resulted in an empty list

when changing useQuery to useStreamQuery the list displayed correctly

leonidr-da commented 4 years ago

@bartcant Was there an error displaying something or was it the case that a Party could not see any assets?

The semantics of useQuery and useStreamQuery are different, but since the Default page does not let you modify the Asset's I think that it is ok to have a static view requiring a refresh.

bartcant commented 4 years ago

It did not display the list when using useQuery . Once I changed it to useStreamQuery it worked

leonidr-da commented 4 years ago

Maybe there's a bug that your setup is highlighting. Could you please log the assets variable? I'd like to make sure that you do see the loading = true state, when the page finishes loading.