-
Notifications
You must be signed in to change notification settings - Fork 63
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
feat: add helia/verified-fetch browser example #285
Conversation
@2color I added some updates in #286 that make using it a little more intuitive. I'm good with these changes if we can agree on some of the changes in 286, but we should make sure linting works and tests are implemented before merging. P.S. the monorepo test has been failing for a while. we don't need to fix that in this PR |
This looks pretty neat, some things to fix before merging, in decreasing importance:
|
Co-authored-by: Alex Potsides <alex@achingbrain.net>
@achingbrain Agree on the first two points. Re 3:
Yeah that's a good point. It's really hard to just use React & Tailwind without importing a whole morass of other stuff. Practically though, none of our IPFS stuff is friendly for time-poor junior developer. I'll take a look at:
I still think it'd be useful to have an example like this (in its current state). Maybe we move some of this to the next.js example which we already have and has React.
How critical is that? These are examples, why not make them a little fun and colourful? |
My concern with this is that we merge it and move on because we are time pressed, then six months down the line there's a regression in a dep that on balance we could show how This has happened multiple times in this repo and the preceding
The focus of the The coding conventions/module formats etc between This example is about
I'm down for fun and colourful, stick a hot pink Helia logo in there! But again the maintenance burden is what concerns me. If we end up with 15-20 examples in this repo and are all a bit different, trying to update things when they break can become overwhelming and people tend to give up. |
@achingbrain I've pushed some changes to simplify the code a fair bit and to remove as many deps as possible. I saw that the linting failed but I couldn't figure out exactly why: https://github.com/ipfs-examples/helia-examples/actions/runs/7843490975/job/21403945128#step:6:29 I'm getting a different error when running the
Any pointers as to why and what's the best way to resolve this? |
@achingbrain I added a test that checks the basic rendering of the page. It seems that all the other tests avoid any network activity for the test (sensible). Is there anything you'd test here other than some UI elements getting rendered? |
@2color take a look at #290 and let me know what you think. During testing it uses an extended vite config to override the import of the This would let us test that the rendering of each supported content type works as expected without having to go to the network at any point. I just filled out a simple JSON codec one, but it can be expanded to handle everything else, I think? |
I added a few more tests to #290 - it seems DAG-CBOR handling is a little wonky, calling |
* chore: add test to verified fetch example Adds a test for JSON-codec data * chore: test verified fetch during ci * chore: add tests for other types
@achingbrain ipfs/helia#429 broke the tests here (https://github.com/ipfs-examples/helia-examples/actions/runs/7871416533/job/21474667989):
I'm looking into the helia source to see how to adapt the blockstore override for the tests to pass again. Let me know if you have any pointers. |
Ha, it broke the hack that allowed testing this example. |
@achingbrain Friendly ping |
I tried to load the Uniswap JSON file, nothing much was happening so I tried to load the video, then the Uniswap file appeared. I guess in-flight requests are not cancelled when a new request is made? |
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.
LGTM, just needs the skipped DAG-CBOR test enabling and for multiple load requests to not trample all over each other (see comment above)
I tried to add request cancellation using an AbortController but it seems to not work due to a bug in @helia/verified-fetch. |
I implemented that now. |
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'm good with merging this. some suggestions for improvement though
FYI that the test succeeds locally, and when ran in isolation, but failed in monorepo test: https://github.com/ipfs-examples/helia-examples/actions/runs/8455093871/job/23162709742?pr=285#step:7:464 I kicked off another retry (but saw that it had already been retried). not sure what's going on. |
Thanks @SgtPooki. I've addressed all the feedback. Thrilled to have this example to point folks to. |
This PR adds a new example of the @helia/verified-fetch library in the browser.