Skip to content

Conversation

Anemy
Copy link
Member

@Anemy Anemy commented Sep 23, 2025

Part of COMPASS-8170

Related pr #7366

@Anemy Anemy added the no-title-validation Skips validation of PR titles (conventional commit adherence + JIRA ticket inclusion) label Sep 23, 2025
@Anemy Anemy requested a review from a team as a code owner September 23, 2025 21:30
@Anemy Anemy requested review from Copilot and ivandevp and removed request for Copilot September 23, 2025 21:30
customFocusTrapFallback={`#${innerContentTestId}`}
setOpen={() => {}}
trigger={({ onClick, ref, children }) => (
trigger={({ onClick, children }) => (
Copy link
Collaborator

Choose a reason for hiding this comment

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

This doesn't look right, ref needs to be passed to the trigger for the component to work (looking at the test, we just don't test the behavior that relies on this)

Copy link
Member Author

@Anemy Anemy Sep 24, 2025

Choose a reason for hiding this comment

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

Will push up some more tests shortly. Ran into something weird here I really don't know the cause of.

Making any of the tests in this file async with a await setTimeout like

await new Promise(resolve => setTimeout(resolve, 10));

(or our waitFor helper) will cause the test to not report any results. I've tried with other tests in compass-components and they don't have the same behavior. It looks like it's something in the render of InteractivePopover that causes it. Maybe the focus trap? Not sure. Going to look at it a bit more, but I'll avoid spending too much time on it.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks for adding more specs! That's indeed weird, was looking through some other tests and what's weird is that some other components that use this one have async tests (at leat at a glance, maybe they're not hitting it) and those are passing 🤔

Copy link
Collaborator

@gribnoysup gribnoysup left a comment

Choose a reason for hiding this comment

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

Approved, but one change doesn't look quite right (it just doesn't currently has a meaningful effect on the tests because they are lacking)

@Copilot Copilot AI review requested due to automatic review settings September 25, 2025 02:08
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds TypeScript type checking to the compass-components package as part of COMPASS-8170. The changes fix TypeScript errors that were revealed when enabling type checking by adding proper type annotations, handling potential null values with optional chaining, and adding missing required props.

Key changes:

  • Added typecheck script to package.json and integrated it into the check command
  • Added proper TypeScript type annotations for variables and function parameters
  • Fixed potential null reference issues with optional chaining operators
  • Added missing required props to component test fixtures

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
package.json Added typecheck script and integrated it into the check command
use-toast.spec.tsx Extracted toast ID generation into a helper function
use-sort.spec.ts Added type casting to fix generic type issues
loader.spec.tsx Added type annotations for sinon spy variables
list-editor.spec.tsx Added type annotations for sinon spy variables
interactive-popover.spec.tsx Added type annotations and new test cases with proper cleanup
guide-cue.spec.tsx Added missing required props to component test
guide-cue-service.spec.ts Improved type safety by removing type casting
file-picker-dialog.spec.tsx Added type annotation for sinon spy variable
document.spec.tsx Added null checks and optional chaining for safer property access
content-with-fallback.spec.tsx Fixed array destructuring issue with HTMLCollection

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@gribnoysup
Copy link
Collaborator

@Anemy CI is green, so I'll merge because there's some changes to the tsconfig structure I'm planning to make and I don't want to cause conflicts for this patch. Thanks for doing this work!

@gribnoysup gribnoysup merged commit 000afcb into main Sep 25, 2025
83 of 84 checks passed
@gribnoysup gribnoysup deleted the add-typecheck-to-compass-components branch September 25, 2025 08:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-title-validation Skips validation of PR titles (conventional commit adherence + JIRA ticket inclusion)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants