on master help sign in
Merge pull request #590 from urbit/m/starrelease-error-handling

store: distinguish SR failure state from loading

commit832e64331a8dfa95aa43c0066b780c242df3f9d8 authorfang <github@fang.io> dateThu 1 Jul 2021, 11:32 (5 years ago) parent602866e5d0ea53
2 files changed+5−4
src/store/lib/useStarReleaseStore.js+2−2 src/views/Points.js+3−2
src/store/lib/useStarReleaseStore.js+2−2
@@ -49,8 +49,8 @@ export default function useStarRelease() {
4949
5050 _setDetails(Just(result));
5151 } catch (e) {
52− _setDetails(Nothing());
53− console.error(e);
52+ _setDetails(Just(null));
53+ console.error('error fetching star release details', e);
5454 }
5555 }, [contracts, wallet]);
5656
src/views/Points.js+3−2
@@ -151,7 +151,8 @@ export default function Points() {
151151 all.length === 1 &&
152152 incoming.length === 0 &&
153153 maybeOutgoingPoints.value.length === 0 &&
154− starReleaseDetails.value.total === 0
154+ (starReleaseDetails.value === null ||
155+ starReleaseDetails.value.total === 0)
155156 ) {
156157 setPointCursor(Just(all[0]));
157158 popAndPush(names.POINT);
@@ -196,7 +197,7 @@ export default function Points() {
196197 !loading && incomingPoints.length === 0 && allPoints.length === 0;
197198
198199 const starReleasing = starReleaseDetails
199− .map(s => s.total > 0)
200+ .map(s => (s ? s.total > 0 : false))
200201 .getOrElse(false);
201202
202203 useEffect(() => {