-
Notifications
You must be signed in to change notification settings - Fork 4
feat: edit global sponsor page template #793
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,7 +14,7 @@ | |
| import React from "react"; | ||
| import T from "i18n-react/dist/i18n-react"; | ||
| import "awesome-bootstrap-checkbox/awesome-bootstrap-checkbox.css"; | ||
| import { Input, Dropdown } from "openstack-uicore-foundation/lib/components"; | ||
| import { Dropdown, Input } from "openstack-uicore-foundation/lib/components"; | ||
| import TextEditorV3 from "openstack-uicore-foundation/lib/components/inputs/editor-input-v3"; | ||
| import { isEmpty, scrollToError, shallowEqual } from "../../utils/methods"; | ||
|
|
||
|
|
@@ -103,6 +103,11 @@ class MediaUploadForm extends React.Component { | |
| .filter((t) => t.class_name === "PresentationType") | ||
| .map((t) => ({ value: t.id, label: t.name })); | ||
|
|
||
| const mediaFileTypesDDL = mediaFileTypes.map((mft) => ({ | ||
| value: mft.id, | ||
| label: mft.name | ||
| })); | ||
|
Comment on lines
+106
to
+109
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Guard against undefined If the prop is briefly undefined while loading, this will throw and break the form. 🛠️ Suggested fix- const mediaFileTypesDDL = mediaFileTypes.map((mft) => ({
+ const mediaFileTypesDDL = (mediaFileTypes || []).map((mft) => ({
value: mft.id,
label: mft.name
}));Also applies to: 191-191 🤖 Prompt for AI Agents |
||
|
|
||
| return ( | ||
| <form className="media-upload-form"> | ||
| <input type="hidden" id="id" value={entity.id} /> | ||
|
|
@@ -183,7 +188,7 @@ class MediaUploadForm extends React.Component { | |
| className="right-space" | ||
| value={entity.type_id} | ||
| placeholder={T.translate("media_upload.placeholders.select_type")} | ||
| options={mediaFileTypes} | ||
| options={mediaFileTypesDDL} | ||
| onChange={this.handleChange} | ||
| /> | ||
| </div> | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,23 +1,21 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||
| import React from "react"; | ||||||||||||||||||||||||||||||||||||||||||||||||
| import TextEditorV3 from "openstack-uicore-foundation/lib/components/inputs/editor-input-v3"; | ||||||||||||||||||||||||||||||||||||||||||||||||
| import { useFormikContext } from "formik"; | ||||||||||||||||||||||||||||||||||||||||||||||||
| import { useField } from "formik"; | ||||||||||||||||||||||||||||||||||||||||||||||||
| import normalizeHtmlString from "../../utils/normalize-html-string"; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| const FormikTextEditor = ({ name, ...props }) => { | ||||||||||||||||||||||||||||||||||||||||||||||||
| const { values, errors, touched, setFieldValue, setFieldTouched } = | ||||||||||||||||||||||||||||||||||||||||||||||||
| useFormikContext(); | ||||||||||||||||||||||||||||||||||||||||||||||||
| const [field, meta, helpers] = useField(name); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| return ( | ||||||||||||||||||||||||||||||||||||||||||||||||
| <TextEditorV3 | ||||||||||||||||||||||||||||||||||||||||||||||||
| name={name} | ||||||||||||||||||||||||||||||||||||||||||||||||
| id={name} | ||||||||||||||||||||||||||||||||||||||||||||||||
| value={values[name]} | ||||||||||||||||||||||||||||||||||||||||||||||||
| value={field.value} | ||||||||||||||||||||||||||||||||||||||||||||||||
| onChange={(e) => { | ||||||||||||||||||||||||||||||||||||||||||||||||
| const stringValue = normalizeHtmlString(e.target.value); | ||||||||||||||||||||||||||||||||||||||||||||||||
| setFieldValue(name, stringValue); | ||||||||||||||||||||||||||||||||||||||||||||||||
| helpers.setValue(stringValue); | ||||||||||||||||||||||||||||||||||||||||||||||||
| }} | ||||||||||||||||||||||||||||||||||||||||||||||||
| onBlur={() => setFieldTouched(name, true)} | ||||||||||||||||||||||||||||||||||||||||||||||||
| error={touched?.[name] && errors?.[name] ? errors?.[name] : ""} | ||||||||||||||||||||||||||||||||||||||||||||||||
| error={meta.touched && meta.error} | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
10
to
+18
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: cat -n src/components/inputs/formik-text-editor.jsRepository: fntechgit/summit-admin Length of output: 947 🏁 Script executed: fd TextEditorV3 -t js --exec head -20 {} \;Repository: fntechgit/summit-admin Length of output: 235 🏁 Script executed: rg "useField|useFormik|connect" src/components/inputs/formik-text-editor.js -A 5Repository: fntechgit/summit-admin Length of output: 334 🏁 Script executed: rg "TextEditorV3" -t jsx -t js -A 3 src/Repository: fntechgit/summit-admin Length of output: 93 🏁 Script executed: rg "useField" -t jsx -t js -B 2 -A 10 src/components/inputs/Repository: fntechgit/summit-admin Length of output: 93 🏁 Script executed: fd formik -t js src/components/inputs/ --exec basename {} \;Repository: fntechgit/summit-admin Length of output: 235 🏁 Script executed: rg "TextEditorV3" src/ -A 3Repository: fntechgit/summit-admin Length of output: 18232 🏁 Script executed: rg "useField" src/components/inputs/ -B 2 -A 10Repository: fntechgit/summit-admin Length of output: 1367 🏁 Script executed: find src/components/inputs -name "*formik*"Repository: fntechgit/summit-admin Length of output: 109 🏁 Script executed: rg "useField|useFormik" src/components/inputs/ -A 8Repository: fntechgit/summit-admin Length of output: 1022 🏁 Script executed: find src/components/inputs -name "formik-*" -exec basename {} \;Repository: fntechgit/summit-admin Length of output: 87 🏁 Script executed: rg "helpers\." src/components/inputs/ -B 3 -A 2Repository: fntechgit/summit-admin Length of output: 534 🏁 Script executed: rg "FormikTextEditor" src/ -B 2 -A 3Repository: fntechgit/summit-admin Length of output: 12133 🏁 Script executed: find src -name "*.test.*" -o -name "*.spec.*" | head -20Repository: fntechgit/summit-admin Length of output: 1365 🏁 Script executed: rg "field.onBlur" src/Repository: fntechgit/summit-admin Length of output: 152 🏁 Script executed: cat -n src/components/mui/formik-inputs/mui-formik-textfield.js | head -50Repository: fntechgit/summit-admin Length of output: 1576 🏁 Script executed: rg "onBlur" src/components/mui/formik-inputs/ -B 2 -A 2Repository: fntechgit/summit-admin Length of output: 502 Wire Without 🛠️ Suggested fix onChange={(e) => {
const stringValue = normalizeHtmlString(e.target.value);
helpers.setValue(stringValue);
}}
+ onBlur={field.onBlur}
error={meta.touched && meta.error}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||
| license={process.env.JODIT_LICENSE_KEY} | ||||||||||||||||||||||||||||||||||||||||||||||||
| {...props} | ||||||||||||||||||||||||||||||||||||||||||||||||
| /> | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -20,13 +20,22 @@ import { FormikProvider, useFormik } from "formik"; | |||||||||||||||||||||||||||||||||||||||||
| import * as yup from "yup"; | ||||||||||||||||||||||||||||||||||||||||||
| import MuiFormikTextField from "../../../../components/mui/formik-inputs/mui-formik-textfield"; | ||||||||||||||||||||||||||||||||||||||||||
| import PageModules from "./page-template-modules-form"; | ||||||||||||||||||||||||||||||||||||||||||
| import { resetPageTemplateForm } from "../../../../actions/page-template-actions"; | ||||||||||||||||||||||||||||||||||||||||||
| import { | ||||||||||||||||||||||||||||||||||||||||||
| PAGES_MODULE_KINDS, | ||||||||||||||||||||||||||||||||||||||||||
| PAGE_MODULES_MEDIA_TYPES | ||||||||||||||||||||||||||||||||||||||||||
| PAGE_MODULES_MEDIA_TYPES, | ||||||||||||||||||||||||||||||||||||||||||
| PAGE_MODULES_DOWNLOAD | ||||||||||||||||||||||||||||||||||||||||||
| } from "../../../../utils/constants"; | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| const PageTemplatePopup = ({ pageTemplate, open, onClose, onSave }) => { | ||||||||||||||||||||||||||||||||||||||||||
| const PageTemplatePopup = ({ | ||||||||||||||||||||||||||||||||||||||||||
| pageTemplate, | ||||||||||||||||||||||||||||||||||||||||||
| open, | ||||||||||||||||||||||||||||||||||||||||||
| onClose, | ||||||||||||||||||||||||||||||||||||||||||
| onSave, | ||||||||||||||||||||||||||||||||||||||||||
| resetPageTemplateForm | ||||||||||||||||||||||||||||||||||||||||||
| }) => { | ||||||||||||||||||||||||||||||||||||||||||
| const handleClose = () => { | ||||||||||||||||||||||||||||||||||||||||||
| resetPageTemplateForm(); | ||||||||||||||||||||||||||||||||||||||||||
| onClose(); | ||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -78,8 +87,16 @@ const PageTemplatePopup = ({ pageTemplate, open, onClose, onSave }) => { | |||||||||||||||||||||||||||||||||||||||||
| kind: yup.string().equals([PAGES_MODULE_KINDS.DOCUMENT]), | ||||||||||||||||||||||||||||||||||||||||||
| name: yup.string().required(T.translate("validation.required")), | ||||||||||||||||||||||||||||||||||||||||||
| description: yup.string().required(T.translate("validation.required")), | ||||||||||||||||||||||||||||||||||||||||||
| external_url: yup.string(), | ||||||||||||||||||||||||||||||||||||||||||
| file: yup.array().min(1, T.translate("validation.file_required")) | ||||||||||||||||||||||||||||||||||||||||||
| external_url: yup.string().when("type", { | ||||||||||||||||||||||||||||||||||||||||||
| is: PAGE_MODULES_DOWNLOAD.URL, | ||||||||||||||||||||||||||||||||||||||||||
| then: (schema) => schema.required(T.translate("validation.required")), | ||||||||||||||||||||||||||||||||||||||||||
| otherwise: (schema) => schema.nullable() | ||||||||||||||||||||||||||||||||||||||||||
| }), | ||||||||||||||||||||||||||||||||||||||||||
| file: yup.array().when("type", { | ||||||||||||||||||||||||||||||||||||||||||
| is: PAGE_MODULES_DOWNLOAD.FILE, | ||||||||||||||||||||||||||||||||||||||||||
| then: (schema) => schema.min(1, T.translate("validation.file_required")), | ||||||||||||||||||||||||||||||||||||||||||
| otherwise: (schema) => schema.nullable() | ||||||||||||||||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+90
to
+99
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: # Check if the file exists and examine the code at the specified lines
find . -name "index.js" -path "*/sponsors-global/page-templates/page-template-popup/*" | head -5Repository: fntechgit/summit-admin Length of output: 137 🏁 Script executed: # Search for yup usage in the repository to understand context
rg "yup\.string\(\)\.when" --type js -A 3 | head -30Repository: fntechgit/summit-admin Length of output: 552 🌐 Web query:
💡 Result: Biome’s That collides with Yup’s object-form Options to resolve it1) Prefer Yup’s function-form count: yup.number().when('isBig', ([isBig], schema) =>
isBig ? schema.min(5) : schema.min(0)
),2) Suppress the rule for that line/block // biome-ignore lint/suspicious/noThenProperty: Yup's API requires `then`/`otherwise` keys
count: yup.number().when('isBig', {
is: true,
then: (schema) => schema.min(5),
otherwise: (schema) => schema.min(0),
});3) Disable the rule in {
"linter": {
"rules": {
"suspicious": {
"noThenProperty": "off"
}
}
}
}(That configuration key is the one documented for the rule.) [1] Sources: Biome rule docs [1], Yup 🏁 Script executed: # Search for functional form of yup.when() usage in the codebase
rg "\.when\(" --type js -A 2 | grep -A 2 "=>" | head -40Repository: fntechgit/summit-admin Length of output: 2238 🏁 Script executed: # Check if there are examples of yup.when with functional signature
rg "when\(\s*['\"][^'\"]+['\"],\s*\(" --type js -B 1 -A 3 | head -50Repository: fntechgit/summit-admin Length of output: 48 Replace Biome's Suggested fix- external_url: yup.string().when("type", {
- is: PAGE_MODULES_DOWNLOAD.URL,
- then: (schema) => schema.required(T.translate("validation.required")),
- otherwise: (schema) => schema.nullable()
- }),
- file: yup.array().when("type", {
- is: PAGE_MODULES_DOWNLOAD.FILE,
- then: (schema) => schema.min(1, T.translate("validation.file_required")),
- otherwise: (schema) => schema.nullable()
- })
+ external_url: yup.string().when("type", (type, schema) =>
+ type === PAGE_MODULES_DOWNLOAD.URL
+ ? schema.required(T.translate("validation.required"))
+ : schema.nullable()
+ ),
+ file: yup.array().when("type", (type, schema) =>
+ type === PAGE_MODULES_DOWNLOAD.FILE
+ ? schema.min(1, T.translate("validation.file_required"))
+ : schema.nullable()
+ )📝 Committable suggestion
Suggested change
🧰 Tools🪛 Biome (2.3.14)[error] 92-92: Do not add then to an object. (lint/suspicious/noThenProperty) [error] 97-97: Do not add then to an object. (lint/suspicious/noThenProperty) 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| const mediaModuleSchema = yup.object().shape({ | ||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -88,7 +105,7 @@ const PageTemplatePopup = ({ pageTemplate, open, onClose, onSave }) => { | |||||||||||||||||||||||||||||||||||||||||
| type: yup.string().required(T.translate("validation.required")), | ||||||||||||||||||||||||||||||||||||||||||
| upload_deadline: yup.date().required(T.translate("validation.required")), | ||||||||||||||||||||||||||||||||||||||||||
| description: yup.string().required(T.translate("validation.required")), | ||||||||||||||||||||||||||||||||||||||||||
| file_type_id: yup.object().when("type", { | ||||||||||||||||||||||||||||||||||||||||||
| file_type_id: yup.number().when("type", { | ||||||||||||||||||||||||||||||||||||||||||
| is: PAGE_MODULES_MEDIA_TYPES.FILE, | ||||||||||||||||||||||||||||||||||||||||||
| then: (schema) => schema.required(T.translate("validation.required")), | ||||||||||||||||||||||||||||||||||||||||||
| otherwise: (schema) => schema.nullable() | ||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -124,6 +141,7 @@ const PageTemplatePopup = ({ pageTemplate, open, onClose, onSave }) => { | |||||||||||||||||||||||||||||||||||||||||
| ...m, | ||||||||||||||||||||||||||||||||||||||||||
| custom_order: idx | ||||||||||||||||||||||||||||||||||||||||||
| })); | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| onSave({ ...values, modules: modulesWithOrder }); | ||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -148,24 +166,24 @@ const PageTemplatePopup = ({ pageTemplate, open, onClose, onSave }) => { | |||||||||||||||||||||||||||||||||||||||||
| > | ||||||||||||||||||||||||||||||||||||||||||
| <DialogContent sx={{ p: 0 }}> | ||||||||||||||||||||||||||||||||||||||||||
| <Grid2 container spacing={2} size={12} sx={{ p: 2 }}> | ||||||||||||||||||||||||||||||||||||||||||
| <Grid2 spacing={2} size={4}> | ||||||||||||||||||||||||||||||||||||||||||
| <Grid2 size={4}> | ||||||||||||||||||||||||||||||||||||||||||
| <MuiFormikTextField | ||||||||||||||||||||||||||||||||||||||||||
| name="code" | ||||||||||||||||||||||||||||||||||||||||||
| label={T.translate("page_template_list.code")} | ||||||||||||||||||||||||||||||||||||||||||
| fullWidth | ||||||||||||||||||||||||||||||||||||||||||
| /> | ||||||||||||||||||||||||||||||||||||||||||
| </Grid2> | ||||||||||||||||||||||||||||||||||||||||||
| <Grid2 spacing={2} size={8}> | ||||||||||||||||||||||||||||||||||||||||||
| <Grid2 size={8}> | ||||||||||||||||||||||||||||||||||||||||||
| <MuiFormikTextField | ||||||||||||||||||||||||||||||||||||||||||
| name="name" | ||||||||||||||||||||||||||||||||||||||||||
| label={T.translate("page_template_list.name")} | ||||||||||||||||||||||||||||||||||||||||||
| fullWidth | ||||||||||||||||||||||||||||||||||||||||||
| /> | ||||||||||||||||||||||||||||||||||||||||||
| </Grid2> | ||||||||||||||||||||||||||||||||||||||||||
| </Grid2> | ||||||||||||||||||||||||||||||||||||||||||
| <Divider gutterBottom /> | ||||||||||||||||||||||||||||||||||||||||||
| <Divider sx={{ mb: 2 }} /> | ||||||||||||||||||||||||||||||||||||||||||
| <Grid2 container spacing={2} size={12} sx={{ p: 2 }}> | ||||||||||||||||||||||||||||||||||||||||||
| <Grid2 spacing={2} size={4}> | ||||||||||||||||||||||||||||||||||||||||||
| <Grid2 size={4}> | ||||||||||||||||||||||||||||||||||||||||||
| <Button | ||||||||||||||||||||||||||||||||||||||||||
| variant="contained" | ||||||||||||||||||||||||||||||||||||||||||
| fullWidth | ||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -175,7 +193,7 @@ const PageTemplatePopup = ({ pageTemplate, open, onClose, onSave }) => { | |||||||||||||||||||||||||||||||||||||||||
| {T.translate("page_template_list.page_crud.add_info")} | ||||||||||||||||||||||||||||||||||||||||||
| </Button> | ||||||||||||||||||||||||||||||||||||||||||
| </Grid2> | ||||||||||||||||||||||||||||||||||||||||||
| <Grid2 spacing={2} size={4}> | ||||||||||||||||||||||||||||||||||||||||||
| <Grid2 size={4}> | ||||||||||||||||||||||||||||||||||||||||||
| <Button | ||||||||||||||||||||||||||||||||||||||||||
| variant="contained" | ||||||||||||||||||||||||||||||||||||||||||
| fullWidth | ||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -185,7 +203,7 @@ const PageTemplatePopup = ({ pageTemplate, open, onClose, onSave }) => { | |||||||||||||||||||||||||||||||||||||||||
| {T.translate("page_template_list.page_crud.add_doc")} | ||||||||||||||||||||||||||||||||||||||||||
| </Button> | ||||||||||||||||||||||||||||||||||||||||||
| </Grid2> | ||||||||||||||||||||||||||||||||||||||||||
| <Grid2 spacing={2} size={4}> | ||||||||||||||||||||||||||||||||||||||||||
| <Grid2 size={4}> | ||||||||||||||||||||||||||||||||||||||||||
| <Button | ||||||||||||||||||||||||||||||||||||||||||
| variant="contained" | ||||||||||||||||||||||||||||||||||||||||||
| fullWidth | ||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -196,7 +214,7 @@ const PageTemplatePopup = ({ pageTemplate, open, onClose, onSave }) => { | |||||||||||||||||||||||||||||||||||||||||
| </Button> | ||||||||||||||||||||||||||||||||||||||||||
| </Grid2> | ||||||||||||||||||||||||||||||||||||||||||
| </Grid2> | ||||||||||||||||||||||||||||||||||||||||||
| <Divider gutterBottom /> | ||||||||||||||||||||||||||||||||||||||||||
| <Divider sx={{ mb: 2 }} /> | ||||||||||||||||||||||||||||||||||||||||||
| <Box sx={{ py: 2 }}> | ||||||||||||||||||||||||||||||||||||||||||
| <PageModules name="modules" /> | ||||||||||||||||||||||||||||||||||||||||||
| </Box> | ||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -219,8 +237,10 @@ PageTemplatePopup.propTypes = { | |||||||||||||||||||||||||||||||||||||||||
| onSave: PropTypes.func.isRequired | ||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| const mapStateToProps = ({ currentPageTemplateState }) => ({ | ||||||||||||||||||||||||||||||||||||||||||
| ...currentPageTemplateState | ||||||||||||||||||||||||||||||||||||||||||
| const mapStateToProps = ({ pageTemplateState }) => ({ | ||||||||||||||||||||||||||||||||||||||||||
| pageTemplate: pageTemplateState.entity | ||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| export default connect(mapStateToProps, {})(PageTemplatePopup); | ||||||||||||||||||||||||||||||||||||||||||
| export default connect(mapStateToProps, { | ||||||||||||||||||||||||||||||||||||||||||
| resetPageTemplateForm | ||||||||||||||||||||||||||||||||||||||||||
| })(PageTemplatePopup); | ||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Guard
module.filebefore indexing.module.file[0]will throw ifmodule.fileis undefined or not an array, and can drop existing file objects.🛠️ Suggested fix
📝 Committable suggestion
🤖 Prompt for AI Agents