Skip to content
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

Fix: Adds title of tool to feedback commit #226

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

letzfets
Copy link
Contributor

Fixes issue #220

@vercel
Copy link

vercel bot commented Dec 23, 2022

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

Name Status Preview Updated
idg-community 🔄 Building (Inspect) Dec 23, 2022 at 9:46PM (UTC)

Copy link
Owner

@Greenheart Greenheart left a comment

Choose a reason for hiding this comment

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

Nice work @letzfets! Thank you for taking a look at this!

I've added some comments with feedback, and look forward to work together to get this ready and merged! 😄

Comment on lines 60 to +68
const body = `${disclaimer}
${userContent}
---
- URL: ${url}
- Git commit: \`${GIT_COMMIT}\`

---

${userContent}`
`
Copy link
Owner

Choose a reason for hiding this comment

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

This works just as expected - nice work!

I'm changing the formatting slightly to clearly separate the disclaimer from the userContent.

Suggested change
const body = `${disclaimer}
${userContent}
---
- URL: ${url}
- Git commit: \`${GIT_COMMIT}\`
---
${userContent}`
`
const body = `${disclaimer}
---
${userContent}
---
- URL: ${url}
- Git commit: \`${GIT_COMMIT}\``

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, that makes it look nicer! 👍

tools/src/lib/github.ts Show resolved Hide resolved
tools/src/lib/github.ts Outdated Show resolved Hide resolved
tools/src/routes/[link]/+page.server.ts Outdated Show resolved Hide resolved
tools/src/routes/[link]/+page.server.ts Outdated Show resolved Hide resolved
@@ -51,6 +53,7 @@ export const actions: Actions = {
if (!Boolean(data.liked || data.improve)) return { success: false }

Copy link
Owner

Choose a reason for hiding this comment

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

We can load the specific tool referenced for this request, and then use the name when submitting the issue.

To accomplish this, we need to

  1. update the parameters for the default action to include params: { link }.
-      default: async ({ request, url }) => {
+      default: async ({ request, url, params: { link } }) => {
  1. load the tool, and verify that it exists before continuing.
Suggested change
const tool = getToolByLink(link, content)
if (!tool) return { success: false }

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That will load the tool twice for each page from the store: once in the load() function and then again for the feedback submit form via actions.

I have defined tool globally, but the way I did it, the load() function is required to run before actions - not a nice dependency either, because as soon as load() changes, the actions might be broken. Is there a way to only load the tool once for each page? Or is it less of importance how many reads we do to the database? 🤔

Copy link
Contributor Author

@letzfets letzfets left a comment

Choose a reason for hiding this comment

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

Thank you very much for having a look at this.

It starts getting better and better. 😉

What do you think about loading the tool twice per page?

Comment on lines 60 to +68
const body = `${disclaimer}
${userContent}
---
- URL: ${url}
- Git commit: \`${GIT_COMMIT}\`

---

${userContent}`
`
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, that makes it look nicer! 👍

@@ -51,6 +53,7 @@ export const actions: Actions = {
if (!Boolean(data.liked || data.improve)) return { success: false }

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That will load the tool twice for each page from the store: once in the load() function and then again for the feedback submit form via actions.

I have defined tool globally, but the way I did it, the load() function is required to run before actions - not a nice dependency either, because as soon as load() changes, the actions might be broken. Is there a way to only load the tool once for each page? Or is it less of importance how many reads we do to the database? 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants