10
45
Fork
You've already forked doipjs
28

Refactor proofs module #75

Open
vladimyr wants to merge 1 commit from vladimyr/doipjs:refactor-proofs into dev
pull from: vladimyr/doipjs:refactor-proofs
merge into: keyoxide:dev
keyoxide:main
keyoxide:dev
keyoxide:fix-irc-fetcher
keyoxide:new-claim-eveonline-143
keyoxide:prepare-new-release
keyoxide:fix-jsdoc-types
keyoxide:yarn-to-npm
keyoxide:support-openpgp-aspe-claims
keyoxide:support-html-alias
keyoxide:improve-activitypub-support
keyoxide:v1-restructure
keyoxide:into-es-module
keyoxide:support-aspe
keyoxide:fix-js-lsp-issues
keyoxide:improve-linting
keyoxide:add-markers
keyoxide:support-opencollective-claim
keyoxide:support-entity-decoding
keyoxide:use-rome-tools
keyoxide:support-cloudflare-buster
keyoxide:support-fediverse-posts
keyoxide:matrix-room-verification

There isn't much to say about this except that I got rid of nested Promise-s by leveraging async-await 🤷

There isn't much to say about this except that I got rid of nested `Promise`-s by leveraging async-await 🤷
Owner
Copy link

Looks good to me. I remember when I wrote this a few years ago, the use of async in that particular spot was clashing with some linting rules and thus I resorted to that promise situation.

Glad it's all good now and feels much less clunky.

I never really did like the logic I used to find out whether to make a direct request or proxy request. But that's outside the scope of this PR.

I'm happy with this

Looks good to me. I remember when I wrote this a few years ago, the use of async in that particular spot was clashing with some linting rules and thus I resorted to that promise situation. Glad it's all good now and feels much less clunky. I never really did like the logic I used to find out whether to make a direct request or proxy request. But that's outside the scope of this PR. I'm happy with this
src/proofs.js Outdated
@ -194,0 +162,4 @@
try {
return createDefaultRequestPromise(data, opts)
} catch {
return createProxyRequestPromise(data, opts)
Owner
Copy link

If it works: great!

This is the only section of the PR, which I couldn't tell off-hand whether it is equivalent to the previous implementation.

If it works: great! This is the only section of the PR, which I couldn't tell off-hand whether it is equivalent to the previous implementation.
Author
Member
Copy link

Glad that you called that out cause it is indeed wrong. Won't work without adding await-s:

try {
 return await createDefaultRequestPromise(data, opts)
} catch {
 return await createProxyRequestPromise(data, opts)
}

But at this point becomes rather ugly and it is probably better to use standard Promise form:

return createDefaultRequestPromise(data, opts)
 .catch(() => createProxyRequestPromise(data, opts))
Glad that you called that out cause it is indeed wrong. Won't work without adding `await`-s: ```js try { return await createDefaultRequestPromise(data, opts) } catch { return await createProxyRequestPromise(data, opts) } ``` But at this point becomes rather ugly and it is probably better to use standard Promise form: ```js return createDefaultRequestPromise(data, opts) .catch(() => createProxyRequestPromise(data, opts)) ```
Owner
Copy link

Oh, so await vs. return vs. return await is still valid?

Oh, so [await vs. return vs. return await](https://jakearchibald.com/2017/await-vs-return-vs-return-await/) is still valid?
Author
Member
Copy link

And Jake is still smarter than me and his blog is a treasure trove of useful advice and knowledge!

And Jake is still smarter than me and his blog is a treasure trove of useful advice and knowledge!
vladimyr force-pushed refactor-proofs from 05f8d9e27e
All checks were successful
ci/woodpecker/pr/test Pipeline was successful
to 691d7ee61b
All checks were successful
ci/woodpecker/pr/test Pipeline was successful
2024年01月31日 04:01:28 +01:00
Compare
Ryuno-Ki left a comment
Copy link

That looks good to me.

That looks good to me.
vladimyr force-pushed refactor-proofs from 691d7ee61b
All checks were successful
ci/woodpecker/pr/test Pipeline was successful
to 8e08b2a632
All checks were successful
ci/woodpecker/pr/test Pipeline was successful
2024年02月02日 13:41:28 +01:00
Compare
First-time contributor
Copy link

This is outdated and probably needs to be rebased.

This is outdated and probably needs to be rebased.
All checks were successful
ci/woodpecker/pr/test Pipeline was successful
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u refactor-proofs:vladimyr-refactor-proofs
git switch vladimyr-refactor-proofs
Sign in to join this conversation.
No reviewers
Labels
Clear labels
bug
Something is not working

Archived

enhancement
New feature

Archived

Contribution welcome
Get started contributing here
Good first issue
Good if you are new to the project or to open source contributions
Impact
External
Affects the people using the project
Impact
Internal
Affects on the people working on the project
Priority
Critical
Work on right now
Priority
High
Work on at earliest convenience
Priority
Low
Work on in spare time
Priority
Medium
Work on regularly
Review
Duplicate
Already exists
Review
Off Topic
Does not fall within the scope of the repo/project
Status
Backlog
Is not being worked on yet
Status
Blocked
Is waiting on something or someone
Status
Completed
Is done
Status
In Progress
Is being worked on
Status
Investigating
Is waiting on research or questions
Status
Needs Decision
Is waiting on a decision by the devs/contributors
Status
Needs Info
Is waiting on additional information before it can be solved
Status
Needs Triage
Is new issue that needs reviewing
Status
Testing
Is being checked and verified
Status
Waiting For Review
Is waiting on reviewers to approve
Status
Won't Fix
Won't be fixed
Type
Bug
Related to something not working as intended
Type
CI
Related to continuous integration
Type
Documentation
Related to documentation
Type
Enhancement
Related to a new feature or an improved one
Type
New Claim
Related to a new identity claim/proof
Type
Security
Related to security
Type
Tests
Related to code tests
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
4 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
keyoxide/doipjs!75
Reference in a new issue
keyoxide/doipjs
No description provided.
Delete branch "vladimyr/doipjs:refactor-proofs"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?