Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions src/useCaretLayout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -423,10 +423,6 @@ export const useCaretLayout = <Extra extends Record<string, unknown>>(
const handleCaretPositionChange = useEventCallback(
(position: MentionsInputState<Extra>['caretPosition']): void => {
argsRef.current.setState({ caretPosition: position })
requestViewSync({
measureSuggestions: true,
measureInline: true,
})
}
)

Expand Down
2 changes: 1 addition & 1 deletion tests/MentionsInput.performance.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@
emitPerformanceMetric('inline-layout', metrics)

expect(metrics.calculateSuggestionsPositionCalls).toBe(0)
expect(metrics.calculateInlineSuggestionPositionCalls).toBeLessThanOrEqual(3)
expect(metrics.calculateInlineSuggestionPositionCalls).toBe(1)

Check failure on line 168 in tests/MentionsInput.performance.spec.tsx

View workflow job for this annotation

GitHub Actions / build

tests/MentionsInput.performance.spec.tsx > MentionsInput performance > reports layout measurement counts for inline autocomplete interactions

AssertionError: expected 2 to be 1 // Object.is equality - Expected + Received - 1 + 2 ❯ tests/MentionsInput.performance.spec.tsx:168:60

Check failure on line 168 in tests/MentionsInput.performance.spec.tsx

View workflow job for this annotation

GitHub Actions / perf-check

tests/MentionsInput.performance.spec.tsx > MentionsInput performance > reports layout measurement counts for inline autocomplete interactions

AssertionError: expected 2 to be 1 // Object.is equality - Expected + Received - 1 + 2 ❯ tests/MentionsInput.performance.spec.tsx:168:60

Check failure on line 168 in tests/MentionsInput.performance.spec.tsx

View workflow job for this annotation

GitHub Actions / perf-check

tests/MentionsInput.performance.spec.tsx > MentionsInput performance > reports layout measurement counts for inline autocomplete interactions

AssertionError: expected 2 to be 1 // Object.is equality - Expected + Received - 1 + 2 ❯ tests/MentionsInput.performance.spec.tsx:168:60
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Assertion at Line 168 is too strict and is breaking CI

This expectation is currently failing (received 2). Given src/useCaretLayout.ts still computes inline position per eligible flush cycle, this interaction can legitimately produce 2 calls. Use a bounded assertion instead of exact 1 to keep the test stable while still enforcing reduced work.

Suggested patch
-    expect(metrics.calculateInlineSuggestionPositionCalls).toBe(1)
+    expect(metrics.calculateInlineSuggestionPositionCalls).toBeGreaterThan(0)
+    expect(metrics.calculateInlineSuggestionPositionCalls).toBeLessThanOrEqual(2)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
expect(metrics.calculateInlineSuggestionPositionCalls).toBe(1)
expect(metrics.calculateInlineSuggestionPositionCalls).toBeGreaterThan(0)
expect(metrics.calculateInlineSuggestionPositionCalls).toBeLessThanOrEqual(2)
🧰 Tools
🪛 GitHub Actions: Performance Notes

[error] 168-168: Vitest perf test failed: AssertionError at tests/MentionsInput.performance.spec.tsx:168:60 (expected 1, received 2; Object.is equality).

🪛 GitHub Check: perf-check

[failure] 168-168: tests/MentionsInput.performance.spec.tsx > MentionsInput performance > reports layout measurement counts for inline autocomplete interactions
AssertionError: expected 2 to be 1 // Object.is equality

  • Expected
  • Received
  • 1
  • 2

❯ tests/MentionsInput.performance.spec.tsx:168:60


[failure] 168-168: tests/MentionsInput.performance.spec.tsx > MentionsInput performance > reports layout measurement counts for inline autocomplete interactions
AssertionError: expected 2 to be 1 // Object.is equality

  • Expected
  • Received
  • 1
  • 2

❯ tests/MentionsInput.performance.spec.tsx:168:60

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/MentionsInput.performance.spec.tsx` at line 168, Replace the strict
equality assertion on metrics.calculateInlineSuggestionPositionCalls with a
bounded assertion to tolerate legitimate second calls; locate the
expect(metrics.calculateInlineSuggestionPositionCalls).toBe(1) assertion in the
test and change it to a range check such as
expect(metrics.calculateInlineSuggestionPositionCalls).toBeLessThanOrEqual(2)
(or a similar <= bound) so the test still enforces reduced work but allows 2
calls.

})

it('reports layout measurement counts for overlay interactions', async () => {
Expand Down
Loading