Skip to content

Code cleanup with ts options: noUnusedParameters, noUnusedLocals#599

Merged
uldisrudzitis merged 2 commits intomasterfrom
fix-ts-noUnusedLocals-noUnusedParameters
Oct 29, 2025
Merged

Code cleanup with ts options: noUnusedParameters, noUnusedLocals#599
uldisrudzitis merged 2 commits intomasterfrom
fix-ts-noUnusedLocals-noUnusedParameters

Conversation

@uldisrudzitis
Copy link
Copy Markdown
Collaborator

@uldisrudzitis uldisrudzitis commented Oct 29, 2025

Summary by CodeRabbit

  • Refactor

    • Simplified rendering internals and method names to reduce unnecessary parameters and unused code across gallery and section rendering.
    • Streamlined template/style handling and removed obsolete helpers.
  • Bug Fixes / Behavior

    • Preview no longer forces iframe reloads on certain setting changes, reducing unnecessary reloads.
  • Chores

    • Enabled stricter TypeScript checks and removed unused imports/parameters for cleaner code.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Oct 29, 2025

Walkthrough

This PR removes numerous unused parameters and imports across components and rendering services, simplifies preview iframe reload logic, tightens TypeScript strictness with noUnusedLocals/noUnusedParameters, and renames/simplifies several gallery render method signatures.

Changes

Cohort / File(s) Summary
Component event handlers
editor/src/app/inputs/file-input.component.ts, editor/src/app/popup/popup.component.ts
Removed unused Event/element parameters from click handlers and method signatures (removeFile, actionClick) and updated templates to stop passing events.
Preview / font behavior
editor/src/app/preview/preview.component.ts, editor/src/app/preview/preview.service.ts, editor/src/app/preview/style.service.ts
Deleted iframe reload/unload subscription and related constructor deps (renderService, actions$); simplified font-family parsing to use only font name.
Template rendering simplification
editor/src/app/render/template-render.service.ts, editor/src/app/sites/sections/section-head-render.service.ts
Removed several parameters (e.g., sectionSlug, siteTemplatesConfig, sections, user, isShopAvailable) from rendering methods and call sites.
Gallery render services
editor/src/app/sites/sections/entries/galleries/* (row, column, pile, link, slideshow, base) , editor/src/app/sites/sections/entries/section-entry-render.service.ts
Renamed/streamlined methods (getViewDataget*ViewData variants), reduced getGalleryClassList signature to (galleryItemsData, galleryType), and removed many parameters (appState, templateName, isLoopAvailable, asRowGallery, etc.) across gallery renderers and their callers.
Component & utility cleanup
editor/src/app/shared/loading/loading.component.ts, editor/src/app/shop/products/shop-products.component.ts, editor/src/app/shop/settings/shop-settings.component.ts, editor/src/app/sites/media/site-media.component.ts, editor/src/app/sites/sections/site-sections.component.ts, editor/src/app/sites/sections/sections-menu-render.service.ts
Removed unused imports/methods (OnInit, ShopSettingsConfigState, identifySection/identifyEntry), adjusted filter/subscription callbacks to drop unused params, and ensured non-matching products are retained in leftovers.
State & service minor edits
editor/src/app/sites/sites-state/sites.state.ts, editor/src/app/user/user.service.ts
Dropped unused setState from ngxsOnInit destructuring; removed unused UserState import.
TypeScript config
editor/tsconfig.json
Enabled noUnusedLocals and noUnusedParameters.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant UI as UI / Template
  participant PreviewSvc as PreviewService
  participant Iframe as Iframe (embedded)

  rect #f0f8ff
    Note over UI,PreviewSvc: Previous flow (before PR)
    UI->>PreviewSvc: settingsChanged / store actions
    PreviewSvc->>PreviewSvc: connectIframeReload -> subscribe to actions$
    PreviewSvc->>Iframe: trigger reload/unload
    Iframe-->>PreviewSvc: onbeforeunload -> disconnectIframeView
  end

  rect #f7fff0
    Note over UI,PreviewSvc: New flow (after PR)
    UI->>PreviewSvc: settingsChanged / store actions
    PreviewSvc->>PreviewSvc: handle rerender via RerenderService only
    PreviewSvc->>Iframe: update styles / rerender (no action subscription)
  end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

  • Pay special attention to gallery renderers (editor/src/app/sites/sections/entries/galleries/*) for consistent signature changes across base and subclass implementations.
  • Verify no remaining call sites still pass removed parameters (preview service, template/render services).
  • Confirm TypeScript strictness (noUnusedLocals/noUnusedParameters) doesn't introduce new compile errors elsewhere.

Possibly related PRs

  • Angular upgrade to v15 #570 — touches preview.service.ts iframe reload/connect logic; directly related to the preview reload removal in this PR.
  • Angular upgrade to v20 #576 — edits components like file-input.component.ts and popup.component.ts and template event handling; overlaps the event-parameter removals here.
  • Upgrade Angular build process and tests #590 — introduces the same TypeScript compiler options (noUnusedLocals, noUnusedParameters) in tsconfig.json; strongly related to this PR's config change.

Poem

🐰
I hopped through code at break of day,
Took unused params and tucked them away.
I pruned imports, trimmed logic bright,
Now previews hum and galleries light.
A tidy burrow of code — hooray!

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The pull request title "Code cleanup with ts options: noUnusedParameters, noUnusedLocals" is directly and specifically related to the primary changes in the changeset. The raw summary confirms that the PR enables the noUnusedLocals and noUnusedParameters TypeScript compiler options in editor/tsconfig.json and then systematically removes unused parameters and local variables across the codebase to comply with these stricter rules. The title accurately captures both the intent (enabling TypeScript options) and the action (code cleanup), is concise and specific without excessive noise, and provides enough clarity that a developer scanning the history would understand the PR's purpose.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-ts-noUnusedLocals-noUnusedParameters

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
editor/src/app/sites/sections/entries/galleries/gallery-render.service.ts (1)

250-256: Bug: video item src set to length, not URL

item.src uses item.poster.length (number) instead of the poster URL, breaking links and srcset concat.

Apply:

-      if (item.type === 'video') {
-        item.videoLink = item.original;
-        item.src = item.poster.length ? item.poster.length : '#';
-      }
+      if (item.type === 'video') {
+        item.videoLink = item.original;
+        item.src = item.poster && item.poster.length ? item.poster : '#';
+      }

Optionally only append no_cache when src is a URL:

-      item.src += `?no_cache=${Date.now()}`;
+      if (item.src && item.src !== '#') {
+        item.src += `?no_cache=${Date.now()}`;
+      }
editor/src/app/sites/sections/entries/galleries/gallery-row-render.service.ts (1)

32-35: Width calculation adds extra trailing spacing

Current reduce adds SPACE_BETWEEN_ITEMS after the last item, inflating width.

Apply:

-    return galleryItems.reduce((width: number, galleryItem) => {
-      return width + galleryItem.width + this.SPACE_BETWEEN_ITEMS;
-    }, 0);
+    return galleryItems.reduce(
+      (total: number, galleryItem, i) =>
+        total +
+        galleryItem.width +
+        (i < galleryItems.length - 1 ? this.SPACE_BETWEEN_ITEMS : 0),
+      0,
+    );
editor/src/app/sites/sections/entries/galleries/gallery-pile-render.service.ts (1)

14-22: Return type mismatch and missing null‑safety in getGalleryStyles.

Method returns null but is typed as string. Also, galleryItems may be undefined.

Apply:

-  getGalleryStyles(galleryItems): string {
-    if (!galleryItems.length) {
+  getGalleryStyles(galleryItems): string | null {
+    if (!galleryItems?.length) {
       return null;
     }
     const item = galleryItems[0];
-    const height = item.height ? item.height : item.width * 0.5625; // 16:9 ratio
+    const height = item?.height ? item.height : item?.width * 0.5625; // 16:9 ratio
-    return `width:${item.width}px;height:${height}px`;
+    return item?.width ? `width:${item.width}px;height:${height}px` : null;
   }
♻️ Duplicate comments (7)
editor/src/app/sites/sections/entries/galleries/gallery-slideshow-render.service.ts (2)

156-167: Stop passing nulls after signature shrink

After the change above, remove trailing nulls in the render call.

Apply:

-    const viewData = this.getSlideshowViewData(
-      siteSlug,
-      entry,
-      siteSettings,
-      templateName,
-      siteTemplateSettings,
-      isLoopAvailable,
-      asRowGallery,
-      null,
-      null,
-      null,
-    );
+    const viewData = this.getSlideshowViewData(
+      siteSlug,
+      entry,
+      siteSettings,
+      templateName,
+      siteTemplateSettings,
+      isLoopAvailable,
+      asRowGallery,
+    );

9-16: Class list type consistency

This relies on super.getGalleryClassList returning an array; aligns with the base refactor I suggested to always return an array and join in view data. No changes here if base fix is applied.

editor/src/app/sites/sections/entries/galleries/gallery-row-render.service.ts (1)

133-142: Prune nulls after signature shrink

Remove the three nulls when calling getRowViewData if you accept the signature change.

Apply:

-    const viewData = this.getRowViewData(
-      appState,
-      siteSlug,
-      entry,
-      siteSettings,
-      siteTemplateSettings,
-      null,
-      null,
-      null,
-    );
+    const viewData = this.getRowViewData(
+      appState,
+      siteSlug,
+      entry,
+      siteSettings,
+      siteTemplateSettings,
+    );
editor/src/app/sites/sections/entries/galleries/gallery-column-render.service.ts (2)

8-12: Class list return type consistency

Same note as base/other renderers: keep base returning an array and join to string at view-data boundary. This override looks fine once base is consistent.


84-92: Stop passing nulls after signature shrink

Adjust render call accordingly.

Apply:

-    const viewData = this.getColumnViewData(
-      siteSlug,
-      entry,
-      siteSettings,
-      siteTemplateSettings,
-      null,
-      null,
-      null,
-    );
+    const viewData = this.getColumnViewData(
+      siteSlug,
+      entry,
+      siteSettings,
+      siteTemplateSettings,
+    );
editor/src/app/sites/sections/entries/galleries/gallery-link-render.service.ts (2)

8-16: Class list return type consistency

Matches the pattern used elsewhere. OK once base emits array, and you join here.


83-109: Prune nulls after signature shrink

Align render call to the simplified signature.

Apply:

-    const viewData = this.getLinkViewData(
-      siteSlug,
-      entry,
-      siteSettings,
-      siteTemplateSettings,
-      null,
-      null,
-      null,
-    );
+    const viewData = this.getLinkViewData(
+      siteSlug,
+      entry,
+      siteSettings,
+      siteTemplateSettings,
+    );
🧹 Nitpick comments (11)
editor/src/app/sites/sections/sections-menu-render.service.ts (1)

144-191: Consider refactoring the filter logic for clarity.

The current .filter() implementation applies the same boolean condition to all tags rather than filtering individual items. Since the logic determines whether to show the entire submenu (all tags or no tags), consider refactoring for better intent:

const filteredTags = (() => {
  switch (templateName) {
    case 'messy':
      if (siteTemplateSettings.tagsMenu.hidden === 'yes') {
        return [];
      }
      if (
        isResponsive &&
        siteTemplateSettings.tagsMenu.alwaysOpen !== 'yes' &&
        currentSection.name !== section.name
      ) {
        return [];
      }
      break;
    case 'white':
      if (currentSection.name !== section.name) {
        return [];
      }
      break;
  }

  // mashup template shows all submenus open
  // default template has separate submenu
  return sectionTags
    .sort((a, b) => a.order - b.order)
    .map((tag) => {
      return {
        name: tag['@attributes'].name,
        title: tag['@value'],
        attributes: toHtmlAttributes({
          class: this.getSubmenuItemClassList(
            section,
            tag,
            currentSection,
            tagSlug,
          ),
        }),
        linkAttributes: toHtmlAttributes({
          class: 'handle',
          href: this.getUrl(section, siteSlug, tag['@attributes'].name),
        }),
      };
    });
})();

This makes it explicit that the logic controls visibility of the entire submenu rather than filtering individual tags.

editor/src/app/shop/products/shop-products.component.ts (1)

72-101: Good fix: preserving non-matching products is critical.

The explicit else branch (lines 96-98) ensures that products whose uniqid doesn't match the current entry are preserved in leftOverProducts for potential matching against subsequent entries. Without this branch, those products would be lost during the reduction.

While this aligns with the PR's parameter-cleanup objective (removing the unused index parameter), it's more significant—it fixes a logic bug.

Optional: Consider refactoring for clarity.

The nested reduce operations are complex and may benefit from extraction into helper functions or a more readable data transformation pattern (e.g., using filter and map where appropriate). This would improve maintainability without changing behavior.

Example refactor approach:

  • Extract the inner product-matching logic into a named function
  • Consider using filter/map combinations instead of nested reduces where applicable
  • Add type definitions to replace any[] (line 48, 71, etc.)
editor/src/app/sites/media/site-media.component.ts (1)

82-82: Use entry.id for tracking entries in the @for loop.

Tracking by entry uses object identity, which may cause unnecessary re-renders if entry objects are recreated during filtering or mapping operations. The SectionEntry interface has a stable id: string property that should be used as a unique identifier instead.

-@for (entry of selectedSection.entries; track entry) {
+@for (entry of selectedSection.entries; track entry.id) {
editor/src/app/sites/sections/entries/galleries/gallery-slideshow-render.service.ts (1)

64-75: Remove output-parameter pattern; compute locals inside

galleryItemsData/galleryItems/galleryType are derived inside; accepting them then overriding adds noise and invites nulls at call sites.

Apply:

-  getSlideshowViewData(
-    siteSlug,
-    entry,
-    siteSettings,
-    templateName,
-    siteTemplateSettings,
-    isLoopAvailable,
-    asRowGallery,
-    galleryItemsData,
-    galleryItems,
-    galleryType,
-  ): { [key: string]: any } {
-    galleryItemsData = this.getGalleryItemsData(entry);
-    galleryItems = this.generateGalleryItems(
+  getSlideshowViewData(
+    siteSlug,
+    entry,
+    siteSettings,
+    templateName,
+    siteTemplateSettings,
+    isLoopAvailable,
+    asRowGallery,
+  ): { [key: string]: any } {
+    const galleryItemsData = this.getGalleryItemsData(entry);
+    const galleryItems = this.generateGalleryItems(
       siteSlug,
       galleryItemsData,
       entry,
       siteSettings,
     );
-    galleryType =
+    const galleryType =
       entry.mediaCacheData &&
       entry.mediaCacheData['@attributes'] &&
       entry.mediaCacheData['@attributes'].type
         ? entry.mediaCacheData['@attributes'].type
         : siteTemplateSettings.entryLayout.defaultGalleryType;
editor/src/app/sites/sections/entries/galleries/gallery-row-render.service.ts (2)

48-67: Loader height should follow last visible item

Using the last item of the whole gallery can mismatch the visible loader block size.

Apply:

-    const loaderWidth = this.getGalleryWidth(
-      galleryItems.slice(0, galleryItemsLimit),
-    );
-    const lastItem = galleryItems.slice(-1)[0];
+    const limit = Number.isFinite(galleryItemsLimit)
+      ? galleryItemsLimit
+      : galleryItems.length;
+    const visibleItems = galleryItems.slice(0, limit);
+    const loaderWidth = this.getGalleryWidth(visibleItems);
+    const lastItem = visibleItems[visibleItems.length - 1];

69-114: Remove output-parameter pattern; compute locals

As with slideshow, derive galleryItemsData/galleryItems/galleryType locally.

Apply:

-  getRowViewData(
-    appState,
-    siteSlug,
-    entry,
-    siteSettings,
-    siteTemplateSettings,
-    galleryItemsData,
-    galleryItems,
-    galleryType,
-  ): { [key: string]: any } {
-    galleryItemsData = this.getGalleryItemsData(entry);
-    galleryItems = this.generateGalleryItems(
+  getRowViewData(
+    appState,
+    siteSlug,
+    entry,
+    siteSettings,
+    siteTemplateSettings,
+  ): { [key: string]: any } {
+    const galleryItemsData = this.getGalleryItemsData(entry);
+    const galleryItems = this.generateGalleryItems(
       siteSlug,
       galleryItemsData,
       entry,
       siteSettings,
     );
-    galleryType =
+    const galleryType =
       entry.mediaCacheData &&
       entry.mediaCacheData['@attributes'] &&
       entry.mediaCacheData['@attributes'].type
         ? entry.mediaCacheData['@attributes'].type
         : siteTemplateSettings.entryLayout.defaultGalleryType;
editor/src/app/sites/sections/entries/galleries/gallery-column-render.service.ts (1)

24-65: Remove output-parameter pattern; compute locals

Derive galleryItemsData/galleryItems/galleryType inside; trims signature and avoids nulls at call sites.

Apply:

-  getColumnViewData(
-    siteSlug,
-    entry,
-    siteSettings,
-    siteTemplateSettings,
-    galleryItemsData,
-    galleryItems,
-    galleryType,
-  ): { [key: string]: any } {
-    galleryItemsData = this.getGalleryItemsData(entry);
-    galleryItems = this.generateGalleryItems(
+  getColumnViewData(
+    siteSlug,
+    entry,
+    siteSettings,
+    siteTemplateSettings,
+  ): { [key: string]: any } {
+    const galleryItemsData = this.getGalleryItemsData(entry);
+    const galleryItems = this.generateGalleryItems(
       siteSlug,
       galleryItemsData,
       entry,
       siteSettings,
     );
-    galleryType =
+    const galleryType =
       entry.mediaCacheData &&
       entry.mediaCacheData['@attributes'] &&
       entry.mediaCacheData['@attributes'].type
         ? entry.mediaCacheData['@attributes'].type
         : siteTemplateSettings.entryLayout.defaultGalleryType;
editor/src/app/sites/sections/entries/galleries/gallery-link-render.service.ts (1)

28-81: Remove output-parameter pattern; compute locals

Same cleanup as other renderers.

Apply:

-  getLinkViewData(
-    siteSlug,
-    entry,
-    siteSettings,
-    siteTemplateSettings,
-    galleryItemsData,
-    galleryItems,
-    galleryType,
-  ): { [key: string]: any } {
-    galleryItemsData = this.getGalleryItemsData(entry);
-    galleryItems = this.generateGalleryItems(
+  getLinkViewData(
+    siteSlug,
+    entry,
+    siteSettings,
+    siteTemplateSettings,
+  ): { [key: string]: any } {
+    const galleryItemsData = this.getGalleryItemsData(entry);
+    const galleryItems = this.generateGalleryItems(
       siteSlug,
       galleryItemsData,
       entry,
       siteSettings,
     );
-    galleryType =
+    const galleryType =
       entry.mediaCacheData &&
       entry.mediaCacheData['@attributes'] &&
       entry.mediaCacheData['@attributes'].type
         ? entry.mediaCacheData['@attributes'].type
         : siteTemplateSettings.entryLayout.defaultGalleryType;
editor/src/app/sites/sections/entries/galleries/gallery-pile-render.service.ts (3)

67-82: Add explicit return type to render.

Small clarity win and prevents accidental return type drift.

Apply:

-  render(siteSlug, siteSettings, entry, siteTemplateSettings) {
+  render(siteSlug, siteSettings, entry, siteTemplateSettings): string {

84-92: Stop passing null placeholders; call the simplified getPileViewData.

After removing unused parameters, this call should be simplified.

Apply:

-    const viewData = this.getPileViewData(
-      siteSlug,
-      entry,
-      siteSettings,
-      siteTemplateSettings,
-      null,
-      null,
-      null,
-    );
+    const viewData = this.getPileViewData(
+      siteSlug,
+      entry,
+      siteSettings,
+      siteTemplateSettings,
+    );

24-65: Remove unused parameters from getPileViewData; declare locally computed variables as const.

The parameters galleryItemsData, galleryItems, and galleryType are reassigned on the first three lines of the method body, making them unused. The sole call site in render() already passes null for these parameters. This refactoring eliminates violations of the noUnusedParameters compiler option.

Apply the suggested diff to remove the three unused parameters from the method signature and declare the locally computed variables as const instead of reassigning parameters.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 656b104 and 78e071a.

📒 Files selected for processing (23)
  • editor/src/app/inputs/file-input.component.ts (2 hunks)
  • editor/src/app/popup/popup.component.ts (2 hunks)
  • editor/src/app/preview/preview.component.ts (0 hunks)
  • editor/src/app/preview/preview.service.ts (1 hunks)
  • editor/src/app/preview/style.service.ts (1 hunks)
  • editor/src/app/render/template-render.service.ts (0 hunks)
  • editor/src/app/shared/loading/loading.component.ts (1 hunks)
  • editor/src/app/shop/products/shop-products.component.ts (1 hunks)
  • editor/src/app/shop/settings/shop-settings.component.ts (0 hunks)
  • editor/src/app/sites/media/site-media.component.ts (2 hunks)
  • editor/src/app/sites/sections/entries/galleries/gallery-column-render.service.ts (4 hunks)
  • editor/src/app/sites/sections/entries/galleries/gallery-link-render.service.ts (4 hunks)
  • editor/src/app/sites/sections/entries/galleries/gallery-pile-render.service.ts (4 hunks)
  • editor/src/app/sites/sections/entries/galleries/gallery-render.service.ts (2 hunks)
  • editor/src/app/sites/sections/entries/galleries/gallery-row-render.service.ts (4 hunks)
  • editor/src/app/sites/sections/entries/galleries/gallery-slideshow-render.service.ts (4 hunks)
  • editor/src/app/sites/sections/entries/section-entry-render.service.ts (0 hunks)
  • editor/src/app/sites/sections/section-head-render.service.ts (0 hunks)
  • editor/src/app/sites/sections/sections-menu-render.service.ts (1 hunks)
  • editor/src/app/sites/sections/site-sections.component.ts (1 hunks)
  • editor/src/app/sites/sites-state/sites.state.ts (1 hunks)
  • editor/src/app/user/user.service.ts (0 hunks)
  • editor/tsconfig.json (1 hunks)
💤 Files with no reviewable changes (6)
  • editor/src/app/user/user.service.ts
  • editor/src/app/preview/preview.component.ts
  • editor/src/app/render/template-render.service.ts
  • editor/src/app/shop/settings/shop-settings.component.ts
  • editor/src/app/sites/sections/entries/section-entry-render.service.ts
  • editor/src/app/sites/sections/section-head-render.service.ts
🧰 Additional context used
🧬 Code graph analysis (1)
editor/src/app/popup/popup.component.ts (1)
editor/src/app/popup/popup.interface.ts (1)
  • PopupAction (13-17)
🔇 Additional comments (16)
editor/src/app/shared/loading/loading.component.ts (1)

1-1: LGTM!

Removing the unused OnInit import is correct—the component doesn't implement the lifecycle hook and has no initialization logic. This aligns perfectly with the PR objective to enable stricter TypeScript compiler options.

editor/src/app/sites/sections/sections-menu-render.service.ts (1)

145-145: Correct removal of unused parameter.

The tag parameter was never referenced in the filter predicate, as the logic only depends on template settings and section state. Removing it properly enables the noUnusedParameters TypeScript option.

editor/tsconfig.json (1)

4-5: LGTM! Stricter TypeScript checking enabled.

Enabling noUnusedLocals and noUnusedParameters improves code quality by catching unused variables and parameters at compile time. This aligns well with the broader cleanup efforts across the codebase.

editor/src/app/sites/sections/site-sections.component.ts (1)

197-212: LGTM! Unused parameter removed correctly.

The state parameter was not referenced in the callback body. The current implementation correctly uses store.selectSnapshot to access the required state instead.

editor/src/app/inputs/file-input.component.ts (2)

57-57: LGTM! Template updated to match simplified method signature.


127-137: LGTM! Unused parameter removed correctly.

The fileInput parameter was never used in the method body. The method clears this.value directly without needing a reference to the input element.

editor/src/app/popup/popup.component.ts (2)

25-25: LGTM! Template updated to match simplified method signature.


131-137: LGTM! Unused parameter removed correctly.

The event parameter was never used in the method body. The method only needs the action to determine whether to execute a callback or close the popup.

editor/src/app/sites/sites-state/sites.state.ts (1)

79-94: LGTM! Unused destructured parameter removed correctly.

The setState parameter was extracted from the StateContext but never used in the method body. Only dispatch is needed for the initialization logic.

editor/src/app/preview/style.service.ts (1)

242-259: LGTM! Unused variable removed correctly.

The fontStyle variable was extracted but never used. Only fontName is needed for the CSS rules. Note that the full googleFontSetting.value (including any style specifications like weights) is still passed to WebFont.load on line 248, so font variants are loaded correctly.

editor/src/app/preview/preview.service.ts (3)

3-5: LGTM! Imports streamlined after dependency removal.

Also applies to: 14-14


33-38: LGTM! Constructor simplified after removing unused dependencies.

The removal of renderService and actions$ parameters aligns with the elimination of the action-driven iframe reload mechanism. The service now has a more focused responsibility.


422-427: LGTM! Iframe reload logic simplified.

The method now focuses solely on catching external links, with the complex action-driven reload mechanism removed. This simplification makes the code more maintainable.

editor/src/app/sites/media/site-media.component.ts (1)

73-73: Good simplification—tracking by unique property name.

This change correctly tracks by the section's unique name property, which is clearer and more maintainable than the previous helper method approach.

editor/src/app/sites/sections/entries/galleries/gallery-link-render.service.ts (1)

66-79: The attribute name is correct as written.

The XML source data in sample-data/blog.[section-name].xml confirms the actual attribute is linkTarget (camelCase), not link_target. While this is inconsistent with other attributes like link_address and row_gallery_padding, the code in gallery-link-render.service.ts correctly accesses it as entry.mediaCacheData['@attributes'].linkTarget.

Likely an incorrect or invalid review comment.

editor/src/app/sites/sections/entries/galleries/gallery-render.service.ts (1)

235-243: Stabilize galleryClassList as a string in view data

Base getGalleryClassList currently returns an array while templates expect a string — make the base getter consistently typed as an array and always pass a joined string into the view data.

Apply (example) changes:

-  getGalleryClassList(galleryItemsData, galleryType): string[] | string {
+  getGalleryClassList(galleryItemsData, galleryType): string[] {
     let classes = ['xGalleryContainer'];
     if (galleryItemsData.length) {
       classes.push('xGalleryHasImages');
       classes.push(`xGalleryType-${galleryType}`);
     }
-    return classes;
+    return classes;
   }
-      galleryClassList: this.getGalleryClassList(galleryItemsData, galleryType),
+      galleryClassList: this.getGalleryClassList(galleryItemsData, galleryType).join(' '),

Files/locations to change (from search):

  • editor/src/app/sites/sections/entries/galleries/gallery-render.service.ts — getter and view-data assignment (~lines 235 and 299).
  • editor/src/app/sites/sections/entries/galleries/gallery-row-render.service.ts — view data (~line 105).
  • editor/src/app/sites/sections/entries/galleries/gallery-column-render.service.ts — view data (~line 57).
  • editor/src/app/sites/sections/entries/galleries/gallery-link-render.service.ts — view data (~line 61).
  • editor/src/app/sites/sections/entries/galleries/gallery-pile-render.service.ts — view data (~line 57).
  • editor/src/app/sites/sections/entries/galleries/gallery-slideshow-render.service.ts — uses getSlideshowGalleryClassList (~line 100); ensure that getter either returns a string[] or its call site uses .join(' ').

Verification: run:

  • rg -n "galleryClassList" editor/src | sed -n '1,200p'
  • Confirm all assignments use .join(' ') (or that the called getter returns a string).

Comment on lines +8 to 12
getGalleryClassList(galleryItemsData, galleryType): string[] | string {
let classes = super.getGalleryClassList(galleryItemsData, galleryType);

return (classes as string[]).join(' ');
}
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.

⚠️ Potential issue | 🔴 Critical

Fix unsafe cast and align return type in getGalleryClassList.

super.getGalleryClassList may return a string or string[]. Calling join on a string will throw at runtime. Also, this method always returns a string but is typed as string[] | string.

Apply:

-  getGalleryClassList(galleryItemsData, galleryType): string[] | string {
-    let classes = super.getGalleryClassList(galleryItemsData, galleryType);
-
-    return (classes as string[]).join(' ');
-  }
+  getGalleryClassList(galleryItemsData, galleryType): string {
+    const classes = super.getGalleryClassList(galleryItemsData, galleryType);
+    if (Array.isArray(classes)) {
+      return classes.join(' ');
+    }
+    return classes || '';
+  }
📝 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
getGalleryClassList(galleryItemsData, galleryType): string[] | string {
let classes = super.getGalleryClassList(galleryItemsData, galleryType);
return (classes as string[]).join(' ');
}
getGalleryClassList(galleryItemsData, galleryType): string {
const classes = super.getGalleryClassList(galleryItemsData, galleryType);
if (Array.isArray(classes)) {
return classes.join(' ');
}
return classes || '';
}
🤖 Prompt for AI Agents
In
editor/src/app/sites/sections/entries/galleries/gallery-pile-render.service.ts
around lines 8-12, the method unsafely casts the super result to string[] and
always calls join; change the method to return a string (update signature to
string) and handle both possible super return types safely by checking if
classes is an array then return classes.join(' ') else return classes as string;
remove the unsafe cast and ensure the function consistently returns a single
string.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
editor/src/app/sites/sections/entries/galleries/gallery-render.service.ts (1)

252-252: Consider simplifying the poster check.

While functionally correct, you could simplify the condition for better readability:

-        item.src = item.poster.length ? item.poster : '#';
+        item.src = item.poster ? item.poster : '#';

Since poster is always a string (from line 83), a direct truthy check is more concise and equally effective—empty strings are falsy in JavaScript.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 78e071a and bf0fba3.

📒 Files selected for processing (1)
  • editor/src/app/sites/sections/entries/galleries/gallery-render.service.ts (3 hunks)
🔇 Additional comments (2)
editor/src/app/sites/sections/entries/galleries/gallery-render.service.ts (2)

235-243: LGTM! Clean signature simplification.

The removal of unused entry and siteSettings parameters aligns well with the PR's objective. The method now has a focused signature that matches its actual usage, and the logic correctly builds the gallery class list based only on the data it needs.


290-308: All getGalleryClassList call sites have been correctly updated to the new 2-parameter signature.

Verification confirms the base class method definition (line 235) and all 10 call sites across 6 files (gallery-slideshow-render.service.ts, gallery-row-render.service.ts, gallery-link-render.service.ts, gallery-pile-render.service.ts, gallery-column-render.service.ts) use only the two required parameters: galleryItemsData and galleryType. The refactoring is complete and consistent throughout the codebase.

@uldisrudzitis uldisrudzitis merged commit 7df8507 into master Oct 29, 2025
5 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Nov 11, 2025
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.

1 participant