-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
react: add useProfilePrice hook #868
Conversation
🦋 Changeset detectedLatest commit: c91e6a2 The changes in this PR will be included in the next version bump. This PR includes changesets to release 8 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This pull request has been linked to 1 task:
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
ec15aec
to
47a13ad
Compare
47a13ad
to
5a2a762
Compare
5a2a762
to
2ddec5e
Compare
2ddec5e
to
bd76b98
Compare
packages/gated-content/package.json
Outdated
@@ -116,12 +116,5 @@ | |||
"web/index.ts" | |||
], | |||
"exports": true | |||
}, | |||
"pnpm": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pnpm was complaining about this, it should be defined at the root of the monorepo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the intent was to not have this warning screaming at people using pnpm
to install these packages.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I don't know if this is effective if done on what, from the consumer perspective, is a dependency package.json
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed this as pnpm complains, when running install with:
packages/gated-content | WARN The field "pnpm" was found in /lens-sdk/packages/gated-content/package.json.
This will not take effect. You should configure "pnpm" at the root of the workspace instead.
import { PromiseResultPresenter } from '../../transactions/adapters/PromiseResultPresenter'; | ||
import { ProfilePriceGateway } from './ProfilePriceGateway'; | ||
|
||
export type ProfilePriceResult = ProfilePrices; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to alias it? The Result
suffix could lead to confusion given the term is widely used in the context of Result<T, E>
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ProfilePrices
seems good to go out in the wild, it's DTO anyway.
|
||
void fetchData(); | ||
// eslint-disable-next-line react-hooks/exhaustive-deps | ||
}, []); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we just make it lazy at this point? data
comes back as ProfilePriceResult
as well as part of the lazy callback.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
made it lazy, added also error handling
* @category Misc | ||
* @group Hooks | ||
*/ | ||
export function useProfilePrice(): ReadResult<ProfilePriceResult> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we consolidate the use of plural/singular? Sometimes we say ProfilePrices
, here it's singular.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made it plural as we expect to add more currencies soon
580d7a5
to
4104a3b
Compare
useEffect(() => { | ||
void execute(); | ||
// eslint-disable-next-line react-hooks/exhaustive-deps | ||
}, []); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the only problem is here, if execute
is provided in useEffect deps, then the app is stuck in a never-ending loop.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we brainstorm some options here? Seems a flaw in the way useDeferredTask
is implemented.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
even if not perfect, I'd merge this branch as an example of onchain read hook, and keep it low profile, wdyt?
4104a3b
to
822be70
Compare
822be70
to
06a56cb
Compare
06a56cb
to
7cf5f17
Compare
7cf5f17
to
34f4a41
Compare
34f4a41
to
c91e6a2
Compare
Parking this one for now. |
No description provided.