Skip to content

refactor: Validation stack refactor and SSR support#2261

Merged
rkaraivanov merged 2 commits into
masterfrom
rkaraivanov/validation-stack-refactor
Jun 19, 2026
Merged

refactor: Validation stack refactor and SSR support#2261
rkaraivanov merged 2 commits into
masterfrom
rkaraivanov/validation-stack-refactor

Conversation

@rkaraivanov

Copy link
Copy Markdown
Member

Description

  • Refactor validation stack to support SSR and simplify the logic for determining the validation state of the component.
    This includes changes to the way validation messages are collected and rendered, as well as updates to the
    associated mixins and controllers.

  • Updated mutation observer and slot controllers to better handle SSR scenarios.

Type of Change

  • Refactoring (code improvements without functional changes)

Checklist

  • My code follows the project's coding standards
  • I have tested my changes locally

- Refactor validation stack to support SSR and simplify
the logic for determining the validation state of the component.

This includes changes to the way validation messages are
collected and rendered, as well as updates to the
associated mixins and controllers.

- Updated mutation observer and slot controllers to better handle SSR scenarios.

Copilot AI 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.

Pull request overview

Refactors the validation container/stack to improve determinism and add SSR safety guards across validation rendering, slot handling, and mutation observation, aiming to reduce hydration mismatches and simplify validation state logic.

Changes:

  • Refactors igc-validator to render validation message slots deterministically and to better align initial render output for SSR/hydration.
  • Adds SSR guards to slot and mutation observer controllers to avoid DOM access on the server.
  • Updates the form-associated mixin’s validation cycle bookkeeping and adds SSR short-circuiting for _validate().

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/components/validation-container/validation-container.ts Reworks validation slot/message rendering and projection collection with SSR/hydration considerations.
src/components/common/mixins/forms/associated.ts Adjusts validation-cycle flags/flow and avoids running _validate() on the server.
src/components/common/controllers/slot.ts Adds SSR guard for slot querying and fixes selector quoting for named slots.
src/components/common/controllers/mutation-observer.ts Makes the observer optional and skips MutationObserver setup on the server.

Comment thread src/components/validation-container/validation-container.ts
@rkaraivanov rkaraivanov merged commit 7389a3c into master Jun 19, 2026
7 checks passed
@rkaraivanov rkaraivanov deleted the rkaraivanov/validation-stack-refactor branch June 19, 2026 10:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants