octokit / rest.js

GitHub REST API client for JavaScript
https://octokit.github.io/rest.js
MIT License
525 stars 62 forks source link

[DOCS]: errors in the console, search doesn't work #433

Open dimaqq opened 1 month ago

dimaqq commented 1 month ago

Describe the need

I'm unable to use search at https://octokit.github.io/rest.js/v20

There are also following errors in the console:

Screenshot 2024-05-23 at 13 50 13

production-app.js:283 TypeError: x is not a function
    at n.render (endpoint.js:44:10)
    at Ho (react-dom.production.min.js:187:188)
    at $o (react-dom.production.min.js:186:173)
    at Ku (react-dom.production.min.js:269:427)
    at Li (react-dom.production.min.js:250:347)
    at Ni (react-dom.production.min.js:250:278)
    at Pi (react-dom.production.min.js:250:138)
    at bi (react-dom.production.min.js:243:163)
    at hi (react-dom.production.min.js:237:175)
    at Ji (react-dom.production.min.js:285:27)

SDK Version

v20

API Version

No response

Relevant log output

production-app.js:283 TypeError: x is not a function
    at n.render (endpoint.js:44:10)
    at Ho (react-dom.production.min.js:187:188)
    at $o (react-dom.production.min.js:186:173)
    at Ku (react-dom.production.min.js:269:427)
    at Li (react-dom.production.min.js:250:347)
    at Ni (react-dom.production.min.js:250:278)
    at Pi (react-dom.production.min.js:250:138)
    at bi (react-dom.production.min.js:243:163)
    at hi (react-dom.production.min.js:237:175)
    at Ji (react-dom.production.min.js:285:27)

Code of Conduct

github-actions[bot] commented 1 month ago

πŸ‘‹ Hi! Thank you for this contribution! Just to let you know, our GitHub SDK team does a round of issue and PR reviews twice a week, every Monday and Friday! We have a process in place for prioritizing and responding to your input. Because you are a part of this community please feel free to comment, add to, or pick up any issues/PRs that are labled with Status: Up for grabs. You & others like you are the reason all of this works! So thank you & happy coding! πŸš€

hunxjunedo commented 1 month ago

@dimaqq kindly assign this issue to me.

gr2m commented 1 month ago

All yours @hunxjunedo πŸ‘ Thanks for looking into it

hunxjunedo commented 1 month ago

it's weird that the search is working absolutely fine on my system, however I noticed a small difference, the live version doesn't show the favicon, while the local one does. Will take some time identifying the problem

EDIT: I looked into it, when it is served with HMR its fine, but when I build and then serve it, it shows the same error. prolly some issue with the plugins.

THE ISSUE: it's related to how Gatsby performs hydration and re-rendering in production mode: https://github.com/gatsbyjs/gatsby/discussions/17914

EDIT: after trying almost everything, it's still not working. the main issue is that it's allowing to change the state, whether it be through useState or react Contexts. This is explained by the fact the the menu toggle icon has been disabled as well, I assume some other dev had looked into that and just disabled the option.

hunxjunedo commented 1 month ago

I'm pretty sure an issue of this type is not new in this repo, the disabled menu button despite the complete functionality in code clearly shows that it was once written to work, but was disabled due to the exact same problem with Gatsby. Now we have to decide the severity of this issue: do we need to migrate from Gatsby or just leave it as it is.

gr2m commented 1 month ago

I assume that problem existed for a long while. And @octokit/rest is an Octokit SDK variant that exists for legacy reasons. We recommend to use https://github.com/octokit/octokit.js instead. All this to say, this is not urgent. I also think that Gatsby is overkill for this documentation page

hunxjunedo commented 1 month ago

Will be happy contribute to the new docs, just lemme know when you guys are looking to do it, this can be done in really simpler way other than Gatsby. Today was real hectic.

wolfy1339 commented 1 month ago

Feel free to contribute to a new docs page. There isn't a set timeline

hunxjunedo commented 1 month ago

Alr, will look into it in the near future.

AbandonedCart commented 1 month ago

I assume that problem existed for a long while. And @octokit/rest is an Octokit SDK variant that exists for legacy reasons. We recommend to use https://github.com/octokit/octokit.js instead. All this to say, this is not urgent. I also think that Gatsby is overkill for this documentation page

I'd like to make a counterpoint to this. I forked a project that was using this instead of the newer version you linked. Unfortunately, I am unable to search in the documentation to make sure I understand what they were trying to accomplish before hastily attempting to rewrite it. The documentation of an obsolete project is perhaps the most important thing to leave in a working state.

TypeError: x is not a function
    render endpoint.js:44
    React 13
    v production-app.js:283
    5824 production-app.js:294
react-dom.production.min.js:216:199
    React 5
    unstable_runWithPriority scheduler.production.min.js:18
    React 9
    v production-app.js:283
    5824 production-app.js:294
TypeError: x is not a function
    render endpoint.js:44
    React 13
    v production-app.js:283
    5824 production-app.js:294
react-dom.production.min.js:216:199
    React 5
    unstable_runWithPriority scheduler.production.min.js:18
    React 4
    unstable_runWithPriority scheduler.production.min.js:18
    React 6
    v production-app.js:283
    5824 production-app.js:294
Uncaught TypeError: x is not a function
    render endpoint.js:44
    React 13
    v production-app.js:283
    5824 production-app.js:294
endpoint.js:44:9
    render endpoint.js:44
    React 13
    v production-app.js:283
    5824 production-app.js:294
hunxjunedo commented 1 month ago

Yeah it has been understood and acknowledged, and I intend to release a functional and better version of the docs soon Inshallah.

wolfy1339 commented 1 month ago

I'd like to make a counterpoint to this. I forked a project that was using this instead of the newer version you linked.

@octokit/rest is still being updated, and the same endpoints are available in octokit. The only difference is that the endpoints methods are prefixed with rest. in the octokit package, while here they are available both unprefixed and prefixed.

If you only need the REST endpoints, then this is much more minimal then octokit.

AbandonedCart commented 1 month ago

@octokit/rest is still being updated, and the same endpoints are available in octokit. The only difference is that the endpoints methods are prefixed with rest. in the octokit package, while here they are available both unprefixed and prefixed.

If you only need the REST endpoints, then this is much more minimal then octokit.

Unfortunately, what I needed was to know was about the code I ended up with that already made that decision. I found my answers, but it was a needlessly tedious process that deterred me from bothering with a change at that point.