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
Large description causes market to hang #775
Comments
|
Thanks for the feedback. Is the home page that is hanging for you or the asset details page? Can you provide a did for ease of testing? |
|
It was on the homepage. The asset details page seemed to work find, so I changed the description to something smaller. I have created a new asset on Rinkeby. In the description I used 100 paragraphs of Lorem Ipsum which was 59,501 bytes. https://market.oceanprotocol.com/asset/did:op:9c63B34bDe74E3200c2ea745BdeDBDE0917b4988 When I try to load the homepage right now (at least while the DID shows up under recently published), the pink wheel spins and after a little while with my laptop fan spinning faster and faster, my Chome tells me the page is unresponsive and asks if I want to exit the page. |
|
Ok, thanks, I replicated the issue. It is not stuck, it just takes a while. Probably because the laptop cpu is slower the chrome thread hangs. Anyway this is not a good/desired behavior, we will come up with a solution. |
|
Any suggestion on how we can fix this on the frontend side? |
|
What do you mean by limiting the description length? If you mean in the publish/edit form that is just one part of the problem. The issue is what happens when it is edited outside. The main problem is that it breaks the search/home page so we need to see why it takes so long to load, is it the http call, is it slow on loading in memory or what is going on. |
|
so we have lots going on with asset teasers descriptions, so my first gut feeling would be checking those 2 libraries we use to process them: https://github.com/oceanprotocol/market/blob/main/src/components/molecules/AssetTeaser.tsx#L47-L51 Take them out and measure again, pretty sure one of those is what's causing large CPU usage. Simple fix then would be to limit the description length before passing it in asset teasers, as there we know we never want any long description anyway |
|
|
|
yeah, that most likely does a lot of live calculation to figure out when it should cut a line. It's only use case is for nicer typography (to prevent widows, orphans, runts) but performance is way more important here. We can remove it in asset teasers and kinda replicate it at least for webkit/blink browsers without the performance overhead:
Still would have drawback that browsers which do not support |
|
well, we can do something way simpler, slice the description before passing it to dotdotdot, to an arbitrary size that it is for sure bigger than what will fit in the teaser. edit : pr was already done |

A large description (or possibly any large metadata) results in the market UI hanging (with the pink spinning wheel) and the browser eventually asking to kill the tab.
To Reproduce
Steps to reproduce the behaviour:
npm run cli publishDataset metadata/testDataset.jsontestData.json:
{ "main": { "type": "dataset", "name": "Test", "dateCreated": "2021-08-05T12:00:00Z", "author": "Test", "license": "Commercial", "files": [{ "contentLength": "71872", "url": "https://example.com/test.csv", "contentType": "text/csv", "encoding": "UTF-8", "index": 0 }], "datePublished": "2021-08-05T12:00:00Z" }, "additionalInformation": { "description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit...", "tags": [], "copyrightHolder": "Test", "inLanguage": "en", "updateFrequency": null } }where the description has ~58kB of text.
The text was updated successfully, but these errors were encountered: