Skip to content

fix(client): prevent infinite recursion in add access key dialog - #2882

Merged
fortuna merged 4 commits into
masterfrom
seer/fix/add-access-key-dialog-recursion
Oct 7, 2026
Merged

fortuna merged 4 commits into
masterfrom
seer/fix/add-access-key-dialog-recursion

Conversation

@sentry

@sentry sentry Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

This PR addresses a RangeError: Maximum call stack size exceeded occurring in the AddAccessKeyDialog component.

Root Cause:
The attributeChangedCallback in add-access-key-dialog was unconditionally calling runAccessKeyChecks(newValue) for every attribute change. This created an infinite recursion cycle due to:

  1. The accessKey property having reflect: true, causing LitElement to reflect property changes back to attributes.
  2. MWC's md-filled-text-field.setValidity (triggered by error state changes) synchronously calling setAttribute, which in turn re-triggered attributeChangedCallback.

Solution:
Introduced a guard in attributeChangedCallback to ensure runAccessKeyChecks is only invoked when the accesskey attribute specifically changes. This breaks the recursive cycle. The attribute name accesskey (lowercase) is used because Lit 3.x automatically lowercases property names when reflecting to attributes.

Tests:
Added a new spec file (index.spec.ts) to cover the behavior of the attributeChangedCallback guard, ensuring that:

  • runAccessKeyChecks is called when accesskey changes.
  • runAccessKeyChecks is not called for unrelated attribute changes.
  • No stack overflow occurs when accesskey is changed.

Fixes OUTLINE-CLIENTS-NM61S

@sentry <feedback>: Autofix iterates on these changes
@sentry stop iterating: Autofix stops iterating on this run

This PR was automatically generated by Sentry at no cost. You can adjust this setting at any time.

@sentry
sentry Bot requested a review from a team as a code owner October 6, 2026 23:02
@greptile-apps

greptile-apps Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

[Medium risk] Fixes infinite recursion in access key dialog.

The PR appears safe to merge; no new actionable issues remain.

What we checked:

  • Unrelated attributes rerun key checks: The callback runs key checks only when the changed attribute is accesskey. Changes to open skip that call.

Summary

Limits AddAccessKeyDialog validation to changes to accesskey, matching the attribute for its reflected accessKey property.

  • Unrelated attribute changes no longer restart access-key checks.

Reviews (2) · Last reviewed commit: "fix(client/web): prevent infinite recurs..." · Reviewed by Greptile

Comment thread client/web/views/root_view/add_access_key_dialog/index.ts Outdated
@github-actions github-actions Bot added size/S and removed size/XS labels Oct 6, 2026
Comment thread client/web/views/root_view/add_access_key_dialog/index.ts
Co-authored-by: sentry[bot] <39604003+sentry[bot]@users.noreply.github.com>
@fortuna fortuna changed the title fix(client/web): prevent infinite recursion in add access key dialog fix(client): prevent infinite recursion in add access key dialog Oct 7, 2026
@fortuna
fortuna merged commit 8c11d0a into master Oct 7, 2026
29 of 30 checks passed
@fortuna
fortuna deleted the seer/fix/add-access-key-dialog-recursion branch October 7, 2026 20:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant