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: over-fetching data in workflows when getting all workflows for eventtype #16879

Merged
merged 1 commit into from
Sep 30, 2024

Conversation

sean-brydon
Copy link
Member

What does this PR do?

fixes: CAL-4433

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • I have added a Docs issue here if this PR makes changes that would require a documentation change. If N/A, write N/A here and check the checkbox.
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

How should this be tested?

Test workflows is working as expected

Checklist

  • I haven't read the contributing guide
  • My code doesn't follow the style guidelines of this project
  • I haven't commented my code, particularly in hard-to-understand areas
  • I haven't checked if my changes generate no new warnings

Copy link

linear bot commented Sep 30, 2024

@graphite-app graphite-app bot requested a review from a team September 30, 2024 08:18
Copy link
Contributor

Hey there and thank you for opening this pull request! 👋🏼

We require pull request titles to follow the Conventional Commits specification and it looks like your proposed title needs to be adjusted.

Details:

No release type found in pull request title "fix over-fetching data in workflows when getting all workflows for eventtype". Add a prefix to indicate what kind of release this pull request corresponds to. For reference, see https://www.conventionalcommits.org/

Available types:
 - feat: A new feature
 - fix: A bug fix
 - docs: Documentation only changes
 - style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
 - refactor: A code change that neither fixes a bug nor adds a feature
 - perf: A code change that improves performance
 - test: Adding missing tests or correcting existing tests
 - build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
 - ci: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
 - chore: Other changes that don't modify src or test files
 - revert: Reverts a previous commit

@dosubot dosubot bot added workflows area: workflows, automations 🐛 bug Something isn't working labels Sep 30, 2024
@keithwillcode keithwillcode added consumer core area: core, team members only labels Sep 30, 2024
@@ -781,6 +780,63 @@ export const getEventTypeWorkflows = async (
userId: number,
eventTypeId: number
): Promise<z.infer<typeof ZWorkflows>> => {
const rawEventType = await EventTypeRepository.findById({ id: eventTypeId, userId });
return rawEventType?.workflows;
const workflows = await prisma.workflow.findMany({
Copy link
Member Author

Choose a reason for hiding this comment

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

@CarinaWolli i tested this and im pretty sure this works as expected - this query has been changed a bit from the one in eventTypes repo.

Targeting the workflow table directly instead of the event types. This generates some nicer SQL for what we needed. Also doesnt over fetch the data outside of eventTypes.workflows that was un-needed in this call

Copy link
Contributor

Choose a reason for hiding this comment

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

I think this would be a good opportunity to add as a method in the workflow repository.

Copy link
Member Author

Choose a reason for hiding this comment

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

I have a separate issue for this! Gonna be extracting a lot of the current workflow repository to a service and handling that migration there. Mind if we pick that up there?

Copy link
Contributor

Choose a reason for hiding this comment

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

Excited to hear! I'm ok with that.

Copy link

graphite-app bot commented Sep 30, 2024

Graphite Automations

"Add consumer team as reviewer" took an action on this PR • (09/30/24)

1 reviewer was added to this PR based on Keith Williams's automation.

"Add ready-for-e2e label" took an action on this PR • (09/30/24)

1 label was added to this PR based on Keith Williams's automation.

@sean-brydon sean-brydon changed the title fix over-fetching data in workflows when getting all workflows for eventtype fix: over-fetching data in workflows when getting all workflows for eventtype Sep 30, 2024
Copy link
Contributor

@joeauyeung joeauyeung left a comment

Choose a reason for hiding this comment

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

LGTM

Test cases

Looks like this is only used to fetch active workflows on the event type pages so I tested the following

  • Personal workflows render properly on personal event type pages
  • Team workflows render properly on team event type pages
  • Org level workflows render properly on team event type pages

Copy link
Contributor

E2E results are ready!

@sean-brydon sean-brydon merged commit da59c9d into main Sep 30, 2024
59 of 80 checks passed
@sean-brydon sean-brydon deleted the chore/eventtype-get-by-id-refactor branch September 30, 2024 21:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working consumer core area: core, team members only ready-for-e2e workflows area: workflows, automations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants