Skip to content

Conversation

@Aryanfour5
Copy link
Contributor

@Aryanfour5 Aryanfour5 commented Oct 31, 2024

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.

@netlify
Copy link

netlify bot commented Oct 31, 2024

👷 Deploy request for codesdrop pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit fe2aab8

@vercel
Copy link

vercel bot commented Oct 31, 2024

@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.

@onkar69483 onkar69483 self-requested a review October 31, 2024 09:19
@vercel
Copy link

vercel bot commented Oct 31, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
codedrop ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 31, 2024 10:45am

console.log("Error fetching paste:", error);
});
id = $page.params.id;
console.log(`fetching /api/paste/${id}`);
Copy link
Owner

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}

Copy link
Contributor Author

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;
Copy link
Owner

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");
})

Copy link
Owner

@onkar69483 onkar69483 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. 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}

  2. 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
    image

@onkar69483 onkar69483 added bug Something isn't working enhancement New feature or request and removed enhancement New feature or request labels Oct 31, 2024
@onkar69483 onkar69483 changed the title Issue handled Infinite "Processing" State for Invalid URLs Oct 31, 2024
@onkar69483
Copy link
Owner

onkar69483 commented Oct 31, 2024

For invalid URL it is showing properly, also go back is working properly to go to home page

image

But for valid url the paste is not loading / it is showing blank

image

Instead it should show something like this

image

}
const data = await res.json();
paste = data;
code = paste.text;
Copy link
Owner

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

@onkar69483 onkar69483 linked an issue Oct 31, 2024 that may be closed by this pull request
</button>
<div>
<!-- download pdf button -->
<button
Copy link
Owner

@onkar69483 onkar69483 Oct 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use old button theme for download and share

WhatsApp Image 2024-10-31 at 16 07 14_b76a8a9c

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Infinite "Processing" State for Invalid URLs in CodeDrop

2 participants