aleph-im / front-aleph-cloud-page

1 stars 0 forks source link

[FIXED] Issue 34: Listener added to wallet provider in order to detect account changed #61

Closed leirbag95 closed 11 months ago

leirbag95 commented 11 months ago

This pull request fixes the issue mentioned in #34 . The issue was related to detecting and reloading when the Ethereum account changes from the wallet provider.

Changes Made:

Test Plan:

Screenshots:

Adapts to the entire application, here is an example after changing account the requirements are updated and the button becomes active

Screenshot 2023-09-21 à 11 11 05 Screenshot 2023-09-21 à 11 11 58
leirbag95 commented 11 months ago

Thanks for the PR! 👌

Changing accounts does indeed updates the address and balance in the store and dispatches the informations on the view. However it does not fetches and refresh the different products (functions, volumes, instances, ... ) of the user, can you take care of this as well ?

It's done :)

I changed the useRequest.ts by adding a triggerDeps param which allows to listen account change from all of account entities

export function useRequest<T>({
  doRequest,
  triggerOnMount,
  triggerDeps = [],
  ...rest
}: UseRequestProps<T>): UseRequestReturn<T> {
...
useEffect(() => {
    if (!triggerOnMount) return
    request()
    // eslint-disable-next-line react-hooks/exhaustive-deps
  }, triggerDeps)
amalcaraz commented 11 months ago

LGTM!