-
Notifications
You must be signed in to change notification settings - Fork 4
Infinite "Processing" State for Invalid URLs #13
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
Conversation
👷 Deploy request for codesdrop pending review.Visit the deploys page to approve it
|
|
@Aryanfour5 is attempting to deploy a commit to the Onkar Mendhapurkar's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
src/routes/[id]/+page.svelte
Outdated
| console.log("Error fetching paste:", error); | ||
| }); | ||
| id = $page.params.id; | ||
| console.log(`fetching /api/paste/${id}`); |
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.
let the route be same as old route i.e /api?id=${id}
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.
ok
| } | ||
| const data = await res.json(); | ||
| paste = data; | ||
| code = paste.text; |
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.
The old method was okay here
fetch(/api?id=${id})
.then((res) => res.json())
.then((data) => {
// console.log("Fetched paste:", data.id);
paste = data.id;
new ClipboardJS(".btn-clip");
})
onkar69483
left a comment
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.
-
Let the route be /{id} as it is used in all other files too, if you change it here as /paste/{id} you would have to change it in every file wherever it is used, so its better to be kept as /{id}
-
Now normal pastes are not opening they are showing paste not found error which should not happen. We only need to show error for the paste which is not found

| } | ||
| const data = await res.json(); | ||
| paste = data; | ||
| code = paste.text; |
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.
Let it be paste.id and not paste.text
| </button> | ||
| <div> | ||
| <!-- download pdf button --> | ||
| <button |
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.





Handling #12
This pull request introduces several enhancements and features to the Paste Viewer component, aimed at improving user experience and functionality.
Changes Made:
Error Handling:
Added comprehensive error handling when fetching paste data from the API. If the paste ID is invalid or non-existent, a user-friendly error message is displayed.
The error message prompts users to check the URL and informs them that the paste may have expired or been removed.