Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis PR refactors page template and show-page handling by removing timezone (summitTZ) parameter passing across components and actions. The timezone transformation is relocated to the show-pages reducer. API expansion parameters are reduced, form control is changed from ID-based to dialog-state management, and stricter guards are added for MEDIA module normalization. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/components/mui/formik-inputs/mui-formik-file-size-field.js`:
- Around line 12-16: The local state val initialized from field.value can get
out of sync when the Formik field changes externally; update the component to
watch field.value and reset val accordingly by adding a useEffect that
recalculates initialValue = field.value != null ? (field.value /
BYTES_PER_MB).toFixed(DECIMAL_DIGITS) : 0 and calls setVal(initialValue)
whenever field.value changes so the displayed value stays in sync with the
Formik field (leave the existing useState(initialValue) and preserve
DECIMAL_DIGITS, BYTES_PER_MB, field, val, setVal identifiers).
In `@src/pages/sponsors-global/page-templates/page-template-popup/index.js`:
- Around line 232-236: The PageTemplatePopup component is missing a PropTypes
entry for the pageTemplate prop used to set initialValues; update
PageTemplatePopup.propTypes to include pageTemplate with the appropriate shape
(e.g., PropTypes.object or a PropTypes.shape describing fields used by
initialValues) and mark it as required if it must always be provided,
referencing PageTemplatePopup, pageTemplate, and initialValues so the component
prop validation matches actual usage.
In `@src/reducers/sponsors/show-pages-list-reducer.js`:
- Around line 119-137: In the RECEIVE_SHOW_PAGE handler, epochToMomentTimeZone
is being called with state.summitTZ which can be null; update the modules
mapping inside currentShowPage so you only call epochToMomentTimeZone when
state.summitTZ is truthy (or use optional chaining to guard the call and/or
chain .format()), e.g. check state.summitTZ before converting each
m.upload_deadline and otherwise leave the raw value (or set null) to avoid
passing null timezone to epochToMomentTimeZone; modify the mapping around
epochToMomentTimeZone in the currentShowPage construction to add this guard.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: cdd7affd-41f2-450b-976d-69a341e23c5e
📒 Files selected for processing (8)
src/actions/page-template-actions.jssrc/actions/show-pages-actions.jssrc/components/mui/formik-inputs/mui-formik-file-size-field.jssrc/pages/sponsors-global/page-templates/page-template-list-page.jssrc/pages/sponsors-global/page-templates/page-template-popup/index.jssrc/pages/sponsors/show-pages-list-page/index.jssrc/reducers/sponsors/show-pages-list-reducer.jssrc/reducers/sponsors_inventory/page-template-list-reducer.js
| PageTemplatePopup.propTypes = { | ||
| open: PropTypes.bool.isRequired, | ||
| onClose: PropTypes.func.isRequired, | ||
| onSave: PropTypes.func.isRequired, | ||
| summitTZ: PropTypes.string.isRequired | ||
| onSave: PropTypes.func.isRequired | ||
| }; |
There was a problem hiding this comment.
Missing pageTemplate prop type definition.
The pageTemplate prop is used at line 130 for initialValues but is not defined in PropTypes.
Proposed fix
PageTemplatePopup.propTypes = {
+ pageTemplate: PropTypes.object.isRequired,
open: PropTypes.bool.isRequired,
onClose: PropTypes.func.isRequired,
onSave: PropTypes.func.isRequired
};📝 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.
| PageTemplatePopup.propTypes = { | |
| open: PropTypes.bool.isRequired, | |
| onClose: PropTypes.func.isRequired, | |
| onSave: PropTypes.func.isRequired, | |
| summitTZ: PropTypes.string.isRequired | |
| onSave: PropTypes.func.isRequired | |
| }; | |
| PageTemplatePopup.propTypes = { | |
| pageTemplate: PropTypes.object.isRequired, | |
| open: PropTypes.bool.isRequired, | |
| onClose: PropTypes.func.isRequired, | |
| onSave: PropTypes.func.isRequired | |
| }; |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/pages/sponsors-global/page-templates/page-template-popup/index.js` around
lines 232 - 236, The PageTemplatePopup component is missing a PropTypes entry
for the pageTemplate prop used to set initialValues; update
PageTemplatePopup.propTypes to include pageTemplate with the appropriate shape
(e.g., PropTypes.object or a PropTypes.shape describing fields used by
initialValues) and mark it as required if it must always be provided,
referencing PageTemplatePopup, pageTemplate, and initialValues so the component
prop validation matches actual usage.
https://app.clickup.com/t/86b79917k
Summary by CodeRabbit
Bug Fixes
Refactor