-
Notifications
You must be signed in to change notification settings - Fork 0
Update ObjectQL components to support all v3.0.1 field types #95
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
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…v3.0.1 field types Co-authored-by: huangyiirene <7665279+huangyiirene@users.noreply.github.com>
…atting Co-authored-by: huangyiirene <7665279+huangyiirene@users.noreply.github.com>
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.
Pull request overview
This PR updates the ObjectForm and ObjectTable components to fully support all 27 field types defined in ObjectQL v3.0.1, enhancing field property handling and adding type-aware formatting for better data representation.
Changes:
- Extended ObjectForm field type mapping from basic types to comprehensive coverage of all 27 ObjectQL field types
- Enhanced field property handling with proper support for min_length, max_length, multiple, accept, and other field-specific attributes
- Added type-aware column formatting in ObjectTable for dates, booleans, numbers, files, lookups, and URLs
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| packages/plugin-object/src/ObjectForm.tsx | Expanded field type mappings to cover all 27 ObjectQL v3.0.1 types, added property handling for file uploads, contact fields, and computed fields, and introduced formatFileSize helper |
| packages/plugin-object/src/ObjectTable.tsx | Added type-specific column formatters for dates, booleans, numbers, files, relationships, and URLs to improve data display |
| column.cell = (value: any) => { | ||
| if (!value) return '-'; | ||
| if (Array.isArray(value)) { | ||
| const count = value.length; |
Copilot
AI
Jan 17, 2026
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.
The pluralization logic is incorrect. When value.length is 1, it will display 'file(s)' instead of 'file'. Consider using conditional logic: ${value.length} ${field.type}${value.length !== 1 ? 's' : ''}
| const count = value.length; | |
| return `${value.length} ${field.type}${value.length !== 1 ? 's' : ''}`; |
| formField.accept = field.accept?.join(','); | ||
| // Add validation hints for file size and dimensions | ||
| if (field.max_size) { | ||
| const sizeHint = `Max size: ${formatFileSize(field.max_size)}`; |
Copilot
AI
Jan 17, 2026
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.
String concatenation for description updates could lead to duplicate size hints if this logic runs multiple times. Consider checking if the description already contains the size hint before appending, or use a more structured approach to store metadata separately from user-facing descriptions.
| const sizeHint = `Max size: ${formatFileSize(field.max_size)}`; | |
| const sizeHint = `(Max size: ${formatFileSize(field.max_size)})`; | |
| const currentDescription = formField.description || ''; | |
| if (!currentDescription.includes(sizeHint)) { | |
| formField.description = currentDescription | |
| ? `${currentDescription} ${sizeHint}` | |
| : sizeHint; | |
| } |
| return '0 B'; | ||
| } |
Copilot
AI
Jan 17, 2026
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.
The formatFileSize function uses toFixed() which returns a string, then interpolates it into another string. This can result in trailing zeros (e.g., '5.0 MB'). Consider using Number(size.toFixed(...)) or format the number differently to avoid unnecessary decimal points for whole numbers.
| return '0 B'; | |
| } | |
| const decimals = unitIndex > 0 ? 1 : 0; | |
| const formattedSize = Number(size.toFixed(decimals)); | |
| return `${formattedSize} ${units[unitIndex]}`; |
📦 Bundle Size Report
Size Limits
|
…backs Co-authored-by: huangyiirene <7665279+huangyiirene@users.noreply.github.com>
📦 Bundle Size Report
Size Limits
|
|
✅ All checks passed!
|
|
✅ All checks passed!
|
📦 Bundle Size Report
Size Limits
|
| // For relationship fields, display the name property if available | ||
| column.cell = (value: any) => { | ||
| if (!value) return '-'; | ||
| if (typeof value === 'object' && value !== null) { |
Check warning
Code scanning / CodeQL
Comparison between inconvertible types Warning
an expression
Copilot Autofix
AI 1 day ago
Copilot could not generate an autofix suggestion
Copilot could not generate an autofix suggestion for this alert. Try pushing a new commit or if the problem persists contact support.
|
✅ All checks passed!
|
The ObjectForm and ObjectTable components only supported a subset of ObjectQL field types, missing newly added types like
markdown,html,time,phone,image,file,location,formula,summary,auto_number,object,vector, andgrid.Changes
ObjectForm
formula,summary,auto_number) to read-onlyinputTypeattributes foremail,phone,url,password,timemaxLength→max_length,minLength→min_lengthfile/imagefieldsObjectTable
date,boolean,number)file/imagefields showing count with proper pluralizationlookup/master_detailfields with safe object fallbackExample
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.