Skip to content

remove supabase dependency#9

Open
adamjonas wants to merge 3 commits intobitcoinsearch:mainfrom
adamjonas:rm-supabase-depends
Open

remove supabase dependency#9
adamjonas wants to merge 3 commits intobitcoinsearch:mainfrom
adamjonas:rm-supabase-depends

Conversation

@adamjonas
Copy link
Copy Markdown
Contributor

No description provided.

@vercel
Copy link
Copy Markdown

vercel bot commented Jul 25, 2023

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

Name Status Preview Comments Updated (UTC)
chat-btc ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 27, 2023 2:14pm

urvishp80
urvishp80 previously approved these changes Jul 25, 2023
@adamjonas adamjonas marked this pull request as draft July 25, 2023 23:31
@adamjonas adamjonas force-pushed the rm-supabase-depends branch from 3eb2ec4 to df51909 Compare July 26, 2023 00:00
@adamjonas adamjonas marked this pull request as ready for review July 26, 2023 00:33
Copy link
Copy Markdown
Contributor

@Extheoisah Extheoisah left a comment

Choose a reason for hiding this comment

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

Looks good. Just a few comments.


export const addFeedback = async (feedback: FeedbackPayload, feedbackId: string) => {
const { status, error } = await SupaBaseDatabase.getInstance().addFeedback({
...feedback,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No need to spread the feedback object. Pass it directly.

Suggested change
...feedback,
feedback,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I get this from my linter when I change to your suggestion:

Argument of type '{ feedback: FeedbackPayload; feedbackId: string; }' is not assignable to parameter of type 'FeedbackPayload'. Object literal may only specify known properties, but 'feedback' does not exist in type 'FeedbackPayload'. Did you mean to write 'feedbackId'?ts(2345)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Okay. its a type issue but this is fine too

setIsFeedbackSubmitted(true);
console.log("Feedback sent successfully");
if (isSupabaseInitialized) {
await addFeedback(feedback, feedbackId);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Since this function returns true or false, we should assign the return value a variable and check if the feedback was submitted. Only then should we setFeedBackSubmitted to true

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yeah, this is a hack to get the page to close.

} else {
console.error('Cannot submit rating because supabase is not initialized');
}
setIsFeedbackSubmitted(true);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We don't want to do this if the db isn't initialised

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

it's the only way that the page closes

Copy link
Copy Markdown
Contributor

@Extheoisah Extheoisah left a comment

Choose a reason for hiding this comment

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

Let's get this in. we'll fix the nits in a later pr

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

Labels

None yet

Projects

Status: 👀 In Review

Development

Successfully merging this pull request may close these issues.

4 participants