Feat: Generalize attribute data field state handling in Filament
Description
This PR aims to generalize how attribute data fields are handled in Filament and fix #2091 and #2071.
- Component state for all fields is set to field value by using the
->getValue()method. - Instance of the field with its value set is returned after dehydration
Todo
- [x] Test that fields are rendered correctly on
ProductEditPage - [x] Test that the form is saved correctly for all Lunar fields as well as custom, user defined fields
- [x] Test custom
RepeaterField - [x] Test custom
BuilderField
- [x] Test custom
The latest updates on your projects. Learn more about Vercel for GitHub.
| Project | Deployment | Preview | Comments | Updated (UTC) |
|---|---|---|---|---|
| lunar-docs | Sep 12, 2025 2:07pm |
@repl6669 Is this still being worked on?
Hello @alecritson, I will give it some more time this weekend. I just need to find out how to properly test it.
Walkthrough
Normalizes AttributeData state handling and generalizes dehydration (removing FileFieldType special-casing), updates StorefrontSession PHPDoc annotations, adds builder/repeater field stubs and synthesizer, expands product edit tests, and adds /.phpactor.json to .gitignore.
Changes
| Cohort / File(s) | Summary |
|---|---|
Attribute state handlingpackages/admin/src/Support/Forms/AttributeData.php |
Normalize component state: unwrap FieldType values via getValue(), filter/reindex arrays, and coerce raw state into expected FieldType during dehydration; removes special-case check for FileFieldType. |
Storefront session PHPDocpackages/core/src/Facades/StorefrontSession.php |
Revise facade PHPDoc: explicit typed accessors and init/reset methods for Channel/Currency/Customer/Groups; documentation-only changes. |
Feature tests (Product edit)tests/admin/Feature/.../EditProductTest.php |
Add synthesizeLivewireProperties pre-mount calls; add tests for rendering and saving builder and repeater attribute fields and broader attribute coverage. |
Test stubs: FieldTypes (JSON-backed)tests/admin/Stubs/FieldTypes/BuilderField.php, tests/admin/Stubs/FieldTypes/RepeaterField.php |
Add BuilderField and RepeaterField test stubs implementing FieldType + JsonSerializable with array validation/normalization. |
Test stubs: Filament FieldTypes + Synthesizertests/admin/Stubs/Support/FieldTypes/BuilderField.php, tests/admin/Stubs/Support/FieldTypes/RepeaterField.php, tests/admin/Stubs/Support/Synthesizers/BuilderSynth.php |
Add Filament components for builder/repeater with format/mutate callbacks and a BuilderSynth for normalized get/set/unset operations. |
Repo config.gitignore |
Ignore /.phpactor.json. |
Estimated code review effort
🎯 3 (Moderate) | ⏱️ ~25 minutes
Assessment against linked issues
| Objective | Addressed | Explanation |
|---|---|---|
| Handle custom attribute file field type saving by not relying on strict FileFieldType comparison in AttributeData (#2091) | ✅ |
Out-of-scope changes
| Code Change | Explanation |
|---|---|
.gitignore updated to ignore /.phpactor.json (.gitignore) |
Repository configuration change unrelated to fixing AttributeData/file-field handling. |
PHPDoc-only updates to StorefrontSession facade (packages/core/src/Facades/StorefrontSession.php) |
Documentation changes to facade annotations do not relate to the file-field saving issue. |
[!TIP]
🔌 Remote MCP (Model Context Protocol) integration is now available!
Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.
✨ Finishing Touches
- [ ] 📝 Generate Docstrings
🧪 Generate unit tests
- [ ] Create PR with unit tests
- [ ] Post copyable unit tests in a comment
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.
🪧 Tips
Chat
There are 3 ways to chat with CodeRabbit:
- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
-
I pushed a fix in commit <commit_id>, please review it. -
Open a follow-up GitHub issue for this discussion.
-
- Files and specific lines of code (under the "Files changed" tab): Tag
@coderabbitaiin a new review comment at the desired location with your query. - PR comments: Tag
@coderabbitaiin a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:-
@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase. -
@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
-
Support
Need help? Create a ticket on our support page for assistance with any issues or questions.
CodeRabbit Commands (Invoked using PR/Issue comments)
Type @coderabbitai help to get the list of available commands.
Other keywords and placeholders
- Add
@coderabbitai ignoreanywhere in the PR description to prevent this PR from being reviewed. - Add
@coderabbitai summaryto generate the high-level summary at a specific location in the PR description. - Add
@coderabbitaianywhere in the PR title to generate the title automatically.
CodeRabbit Configuration File (.coderabbit.yaml)
- You can programmatically configure CodeRabbit by adding a
.coderabbit.yamlfile to the root of your repository. - Please see the configuration documentation for more information.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation:
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
Status, Documentation and Community
- Visit our Status Page to check the current availability of CodeRabbit.
- Visit our Documentation for detailed information on how to use CodeRabbit.
- Join our Discord Community to get help, request features, and share feedback.
- Follow us on X/Twitter for updates and announcements.