-
Notifications
You must be signed in to change notification settings - Fork 72
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
Trying to create REPL share links with large amounts of code fails. #174
Comments
Thanks; I prefer the former; we should trap the error; then if google changes what length they like, we don't have to chase them. |
@buzzdecafe It looks like the REPL has a hard-coded link to the master bundle, so I'm not sure how to test this locally, but I think the following in const getShortUrl = R.map(R.compose(setValue, R.prop('id')));
+ const getErrorMessage = R.map(setValue, R.path(['error', 'message']));
+ const handleResponse = R.ifElse(
+ R.has('error'),
+ getErrorMessage,
+ getShortUrl,
+ );
const futureXhr = getResponse(apiUrl);
- export default () => makeShortUrlBtn.addEventListener('click', () => futureXhr.fork(error, getShortUrl));
+ export default () => makeShortUrlBtn.addEventListener('click', () => futureXhr.fork(error, handleResponse)); If there's a way to test the REPL locally that I'm missing, let me know and I'll send a proper PR. |
repl has its own repo: https://github.com/ramda/repl it's been a while since i've done any work in there, so i don't recall how to build/run locally. ping @craigdallimore @MattMS |
It's been a while since I looked at the REPL integration with the site, so I'll go through it again now and see how it's all setup. |
It seems like the REPL code is still in the site repo, so the new REPL code hasn't been integrated yet. |
In the REPL, trying to create a share link with a large code sample will fail. This happens because Google's URL shortener won't accept URLs over a certain length and returns a
400
error.The shortener seems to start throwing errors at 4,096 characters.
A possible solution would be an error handler for
400
errors from Google that checks the URL length and offers a helpful error message:Alternatively, an event handler on the function that changes the URL could do a quick check for length and disable the share button with a
title
message explaining that the current code snippet is too long to be shared.The text was updated successfully, but these errors were encountered: