Skip to content

fix: page templates list modules undefined#937

Open
priscila-moneo wants to merge 1 commit into
masterfrom
fix/page-templates-list-modules-indefined
Open

fix: page templates list modules undefined#937
priscila-moneo wants to merge 1 commit into
masterfrom
fix/page-templates-list-modules-indefined

Conversation

@priscila-moneo
Copy link
Copy Markdown

@priscila-moneo priscila-moneo commented May 14, 2026

ref: https://app.clickup.com/t/86b92ac9w?comment=90140204473136

Summary by CodeRabbit

  • Bug Fixes
    • Improved handling of page template data to ensure accurate calculation of template properties when module information is missing or null.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 14, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b8f752dc-3aaf-4011-98da-c978d103c898

📥 Commits

Reviewing files that changed from the base of the PR and between 81351ea and dd3d2d7.

📒 Files selected for processing (1)
  • src/reducers/sponsors_inventory/page-template-list-reducer.js

📝 Walkthrough

Walkthrough

The RECEIVE_PAGE_TEMPLATES reducer action now normalizes the modules field to an empty array when nullish before computing module-count fields. The refactored mapping uses a block function with nullish coalescing (a.modules ?? []) to ensure safe filtering and counting against the normalized array.

Changes

Module Nullish Coalescing

Layer / File(s) Summary
Module count computation with null safety
src/reducers/sponsors_inventory/page-template-list-reducer.js
The RECEIVE_PAGE_TEMPLATES reducer maps payload.response.data using a block function that defaults a.modules to [] via nullish coalescing before filtering by PAGES_MODULE_KINDS, ensuring info_mod, upload_mod, and download_mod counts compute safely when modules are missing or null.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Suggested reviewers

  • smarcet
  • santipalenque
  • martinquiroga-exo

Poem

A rabbit hops through nullish fields,
With coalescing it safely yields,
Empty arrays where none exist,
Module counts no longer missed! 🐰✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the specific issue being fixed: handling undefined modules in the page templates list reducer, which directly matches the refactoring described in the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/page-templates-list-modules-indefined

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.

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.

1 participant