Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(FormLayout): split layout logic into distinct classes #8770

Merged
merged 7 commits into from
Mar 7, 2025

Conversation

vursen
Copy link
Contributor

@vursen vursen commented Mar 6, 2025

Description

Extracts layout logic into distinct classes AutoResponsiveLayout and ResponsiveStepsLayout.

Part of vaadin/platform#7172

Type of change

  • Refactor

@vursen vursen changed the title refactor: extract layout logic into controllers refactor(FormLayout): extract layout logic into controllers Mar 6, 2025
@vursen vursen force-pushed the extract-responsive-steps-controller branch from a19bc1e to 28b50c8 Compare March 6, 2025 08:55
@vursen vursen force-pushed the extract-responsive-steps-controller branch 3 times, most recently from d51b5e7 to 22ec06c Compare March 6, 2025 09:18
@vursen vursen marked this pull request as ready for review March 7, 2025 06:39
host.style.setProperty('--_max-columns', Math.min(props.maxColumns, maxColumns));

host.$.layout.toggleAttribute('fits-labels-aside', this.props.labelsAside && this.__fitsLabelsAside);
host.$.layout.style.setProperty('--_grid-rendered-column-count', this.__renderedColumnCount);
Copy link
Contributor Author

@vursen vursen Mar 7, 2025

Choose a reason for hiding this comment

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

I had to revert to the previous approach that may trigger an extra style recalculation due to reading getComputedStyle after setting CSS properties. Without this, some tests failed – apparently, they were passing before due to a different order of observers, which was actually not efficient.

* @private
*/
export class AbstractLayoutController {
constructor(host, config) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it be beneficial to add a JSdoc type definition here to help with autocomplete?
Something like:

  /**
   * @typedef {Object} LayoutControllerConfig
   * @property {MutationObserverInit} mutationObserverOptions - Options for the MutationObserver.
   */

  /**
   * @param {HTMLElement} host
   * @param {LayoutControllerConfig} config
   */
   constructor(host, config) { ... }

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@vursen vursen force-pushed the extract-responsive-steps-controller branch from 34bcd95 to fbb5b1d Compare March 7, 2025 09:09
@vursen vursen force-pushed the extract-responsive-steps-controller branch from fbb5b1d to 399a2fb Compare March 7, 2025 09:11
@vursen vursen changed the title refactor(FormLayout): extract layout logic into controllers refactor(FormLayout): split layout logic into distinct classes Mar 7, 2025
@vursen vursen force-pushed the extract-responsive-steps-controller branch from 6b75af6 to b91c529 Compare March 7, 2025 09:32
Copy link

sonarqubecloud bot commented Mar 7, 2025

Quality Gate Failed Quality Gate failed

Failed conditions
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@vursen vursen merged commit 870230e into main Mar 7, 2025
8 of 9 checks passed
@vursen vursen deleted the extract-responsive-steps-controller branch March 7, 2025 11:05
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.

3 participants