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

_:hammer_and_wrench: Refactor suggestion_ #18

Open
alcercu opened this issue Nov 4, 2024 · 0 comments
Open

_:hammer_and_wrench: Refactor suggestion_ #18

alcercu opened this issue Nov 4, 2024 · 0 comments

Comments

@alcercu
Copy link
Collaborator

alcercu commented Nov 4, 2024

          _:hammer_and_wrench: Refactor suggestion_

Consider enhancing the GraphQL query structure.

The query would benefit from these improvements:

  1. Add a query name for better debugging and monitoring
  2. Consider using a fragment for the repeated button structure

Here's a suggested refactor:

 export const heroQuery = gql`
-  {
+  query GetHomeHero {
+    fragment ButtonFields on Button {
+      text
+      link {
+        url
+      }
+    }
+
     homePageHero {
       title
       subtitle
       primaryButton {
-        text
-        link {
-          url
-        }
+        ...ButtonFields
       }
       secondaryButton {
-        text
-        link {
-          url
-        }
+        ...ButtonFields
       }
       arrowLink {
-        text
-        link {
-          url
-        }
+        ...ButtonFields
       }
       background {
         url
       }
     }
   }
 `;

Committable suggestion was skipped due to low confidence.

Originally posted by @coderabbitai[bot] in #16 (comment)

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

No branches or pull requests

1 participant