Skip to content
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

Client hangs if blockContent contains empty span #66

Open
isaac-jordan opened this issue Nov 9, 2022 · 1 comment
Open

Client hangs if blockContent contains empty span #66

isaac-jordan opened this issue Nov 9, 2022 · 1 comment

Comments

@isaac-jordan
Copy link

Hi there, this JS client seems to hang if there are "text": "" spans in the response from Sanity API. The HTTP endpoint returns the below JSON fine, but the JS client with the same query will hang indefinitely (even if I set a timeout).

It seems like something in the client's processing of responses is hanging forever in some circumstances.

If I change the content in the manager, then the client will start working again.

It often seems worse if it's blank lines under an H1 tag? But I've seen it happen in a few different circumstances. Currently it makes the client pretty much unuseable for me.

Response from HTTP API:

{
    "ms": 6,
    "query": "*[_type == \"post\"]",
    "result": [
        {
            "_createdAt": "2022-11-09T20:13:54Z",
            "_id": "e3d30547-8ee0-42d5-b409-3cf52a208ebc",
            "_rev": "UckHRufVFepji8vDPE9wNu",
            "_type": "post",
            "_updatedAt": "2022-11-09T22:12:57Z",
            "author": {
                "_ref": "ef72f677-3ad6-4975-b4e9-3c585731fb83",
                "_type": "reference"
            },
            "body": [
                {
                    "_key": "aff5062c1d62",
                    "_type": "block",
                    "children": [
                        {
                            "_key": "290029bb1ffc",
                            "_type": "span",
                            "marks": [],
                            "text": "Normal text"
                        }
                    ],
                    "markDefs": [],
                    "style": "normal"
                },
                {
                    "_key": "8d3b960961df",
                    "_type": "block",
                    "children": [
                        {
                            "_key": "3ad547385583",
                            "_type": "span",
                            "marks": [],
                            "text": "H1 text"
                        }
                    ],
                    "markDefs": [],
                    "style": "h1"
                },
                {
                    "_key": "faac7482a0a3",
                    "_type": "block",
                    "children": [
                        {
                            "_key": "dc73e2904a1e",
                            "_type": "span",
                            "marks": [],
                            "text": "Normal text"
                        }
                    ],
                    "markDefs": [],
                    "style": "normal"
                },
                {
                    "_key": "269046411e24",
                    "_type": "block",
                    "children": [
                        {
                            "_key": "8d18d6bdc5d6",
                            "_type": "span",
                            "marks": [],
                            "text": ""
                        }
                    ],
                    "markDefs": [],
                    "style": "normal"
                },
                {
                    "_key": "7dc460534a6a",
                    "_type": "block",
                    "children": [
                        {
                            "_key": "bd15635cc1ca",
                            "_type": "span",
                            "marks": [],
                            "text": ""
                        }
                    ],
                    "markDefs": [],
                    "style": "normal"
                }
            ],
            "categories": [],
            "publishedAt": "2022-11-09T18:10:00.000Z",
            "slug": {
                "_type": "slug",
                "current": "first-post"
            },
            "title": "First Post"
        }
    ]
}
@isaac-jordan
Copy link
Author

Client side call:

await client.fetch(
    `*[_type == "post"]`
);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant