Skip to content

[SCAL-324479]: Allow up to 2 PRIMARY custom actions per target - #692

Open
tushardeepakts wants to merge 1 commit into
mainfrom
SCAL-324479_primary_btn
Open

tushardeepakts wants to merge 1 commit into
mainfrom
SCAL-324479_primary_btn

Conversation

@tushardeepakts

@tushardeepakts tushardeepakts commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Fixed getCustomActions() so the primaryActionsPerTarget map is now enforced, preventing an unlimited number of PRIMARY-position custom actions.
  • Added MAX_PRIMARY_ACTIONS_PER_TARGET = 2.
  • Updated validateCustomAction to enforce a maximum of 2 valid PRIMARY actions per target:
    • Liveboard
    • Viz
    • Answer
  • Additional valid PRIMARY actions are rejected with the new TOO_MANY_PRIMARY_ACTIONS error.
  • Only actions that pass all other validation checks consume a primary-action slot.
  • Updated the CustomActionsPosition.PRIMARY JSDoc in types.ts to document the 2-action limit.
image

@tushardeepakts
tushardeepakts requested a review from a team as a code owner September 29, 2026 10:56

@gemini-code-assist gemini-code-assist Bot left a comment

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.

Code Review

This pull request introduces a limit of up to 2 PRIMARY custom actions per target. It updates the validation logic in src/utils/custom-actions.ts to track and enforce this limit, adds a corresponding error message, updates JSDoc documentation, and includes comprehensive unit tests. Feedback on the pull request points out a style guide violation in a JSDoc comment where a complete sentence does not end with a period.

Comment on lines 60 to 68
/**
* Validates a single custom action based on its target type
* @param action - The custom action to validate
* @param primaryActionsPerTarget - Map to track primary actions per target
* @param primaryActionsPerTarget - Map tracking PRIMARY actions accepted so
* far, keyed by target
* @returns CustomActionValidation with isValid flag and reason string
*
*
* @hidden
*/

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.

medium

According to the repository style guide (Rule 6), every description that forms a complete sentence should end with a period. Please add a period at the end of the description.

Suggested change
/**
* Validates a single custom action based on its target type
* @param action - The custom action to validate
* @param primaryActionsPerTarget - Map to track primary actions per target
* @param primaryActionsPerTarget - Map tracking PRIMARY actions accepted so
* far, keyed by target
* @returns CustomActionValidation with isValid flag and reason string
*
*
* @hidden
*/
/**
* Validates a single custom action based on its target type.
* @param action - The custom action to validate
* @param primaryActionsPerTarget - Map tracking PRIMARY actions accepted so
* far, keyed by target
* @returns CustomActionValidation with isValid flag and reason string
*
* @hidden
*/
References
  1. Every description that forms a complete sentence should end with a period. (link)

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.

Not needed

@tushardeepakts tushardeepakts self-assigned this Sep 29, 2026
@pkg-pr-new

pkg-pr-new Bot commented Sep 29, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@thoughtspot/visual-embed-sdk@692

commit: 9ddd9a9

This branch has not been deployed

No deployments
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.

1 participant