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

6519: adds trigger events to known names #6698

Conversation

grahamlangford
Copy link
Collaborator

@codecov
Copy link

codecov bot commented Oct 24, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (25fc06c) 70.18% compared to head (209ad84) 70.18%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6698   +/-   ##
=======================================
  Coverage   70.18%   70.18%           
=======================================
  Files        1182     1182           
  Lines       36806    36815    +9     
  Branches     6929     6931    +2     
=======================================
+ Hits        25831    25840    +9     
  Misses      10975    10975           
Files Coverage Δ
...itors/eventNameAnalysis/checkEventNamesAnalysis.ts 100.00% <100.00%> (ø)
...tors/eventNameAnalysis/collectEventNamesVisitor.ts 100.00% <100.00%> (ø)
src/bricks/PipelineVisitor.ts 100.00% <ø> (ø)
src/bricks/blockFilterHelpers.ts 78.57% <ø> (ø)
src/pageEditor/PanelContent.tsx 89.79% <ø> (ø)
src/pageEditor/exampleExtensionConfig.ts 0.00% <ø> (ø)
src/pageEditor/pageEditorTypes.ts 100.00% <ø> (ø)
src/pageEditor/panes/insert/InsertPane.tsx 0.00% <ø> (ø)
src/pageEditor/panes/insert/useAutoInsert.ts 0.00% <ø> (ø)
src/pageEditor/sidebar/ExtensionIcons.tsx 80.00% <ø> (ø)
... and 8 more

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -24,6 +24,7 @@ import { type Brick } from "@/types/brickTypes";
import { type Reader } from "@/types/bricks/readerTypes";
import { type Metadata } from "@/types/registryTypes";
import { type UnknownObject } from "@/types/objectTypes";
import { type StarterBrickType } from "@/starterBricks/types";
Copy link
Contributor

Choose a reason for hiding this comment

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

We may want to/need to move the StarterBrickType type to this file. The idea behind the top-level type's folder to hold types that can be safely imported from anywhere without introducing circular module dependencies

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I didn't see any circular dependency warning, but I'll move it anyway.

hasDynamicEventName: this._hasDynamicEventName,
};
}

private visitExtensionPoint(
Copy link
Contributor

Choose a reason for hiding this comment

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

👍


export type EventNameAnalysisResult = {
/**
* Statically known event names in the FormState.
*/
knownNames: string[];
/**
* Event names that are used by a trigger starter brick.
* Kept separate for analysis. Combined with knownNames for runtime.
Copy link
Contributor

Choose a reason for hiding this comment

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

NIT: I'm not sure I follow this comment. Could you clarify why they need to be kept separate for the analysis? I'm assuming it's so that different suggestions can be given for Triggers vs. Emitted Events?

Also, IIRC runtime doesn't use this analysis to run bricks. Is the comment referring to which event name are suggested for the Emit Event brick?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That is what I meant. I updated the comment to be more clear.

@@ -43,7 +43,14 @@ class CheckEventNamesAnalysis extends AnalysisVisitorABC {
}

get knownEventNames(): string[] {
Copy link
Contributor

Choose a reason for hiding this comment

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

The "knownEventNames" vs. "knownNames" distinction is subtle. We probably should improve the naming of knownNames, e.g., knownEmittedNames?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That's a good point. I'll update the name.

Copy link
Contributor

@twschiller twschiller left a comment

Choose a reason for hiding this comment

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

Functionality looks correct, left some comments on clarifying name/comments on the relationship between the two fields in the analysis result

@github-actions
Copy link

When the PR is merged, the first loom link found on this PR will be posted to #sprint-demo on Slack. Do not edit this comment manually.

hasDynamicEventName: this._hasDynamicEventName,
};
}

private visitStarterBrick(
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Calling out that I changed the name of this method from visitExtensionPoint

Comment on lines +34 to +40
/**
* Event names that are used by a trigger starter brick.
* Kept separate to preserve warnings in the trigger starter brick when the event name is not emitted from another brick.
* Combined with knownEmittedNames to get all known event names to set in redux.
* @since 1.8.2
*/
knownTriggerNames: string[];
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm still unsure if I'm happy with this description.

Copy link
Contributor

Choose a reason for hiding this comment

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

Definitely good enough to provide context

@grahamlangford grahamlangford merged commit 209c032 into main Oct 25, 2023
17 checks passed
@grahamlangford grahamlangford deleted the 6519-modify-event-name-collector-to-look-at-custom-event-trigger-names-configured-for-starter-bricks branch October 25, 2023 12:43
@grahamlangford grahamlangford added this to the 1.8.2 milestone Oct 25, 2023
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.

Modify event name collector to look at custom event trigger names configured for starter bricks
2 participants