Inline Creation Modals - Create filament/vendor without leaving page #1
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
When adding a new spool, if the filament doesnt exist, you have to navigate away to create it. Same for vendor when creating filament. This breaks the workflow and is tedious.
Solution
Add inline creation modals:
Implementation Notes
New Components Created
client/src/components/vendorCreateModal.tsxfetch()API call to create vendormessage.success()onSuccess(vendor)callback with the created vendoruseInvalidateto refresh vendor lists after creationclient/src/components/filamentCreateModal.tsxuseSelecthook for vendor dropdowndropdownRenderpattern to add "Create Manufacturer" button at bottom of vendor dropdownFiles Modified
client/src/pages/filaments/create.tsxVendorCreateModalimport and componentisVendorModalOpenstatehandleVendorCreatedhandler that invalidates vendor cache and selects new vendordropdownRenderto vendor Select with "Create Manufacturer" buttonDividerandPlusOutlinedicon importsclient/src/pages/spools/create.tsxFilamentCreateModalimport and componentuseInvalidatehook importIFilamentimportisFilamentModalOpenstatehandleFilamentCreatedhandler that invalidates filament cache and selects new filamentdropdownRenderto filament Select with "Create Filament" buttonclient/public/locales/en/common.jsonvendor.form.created_successtranslationvendor.form.name_requiredtranslationfilament.form.created_successtranslationfilament.form.vendor_placeholdertranslationfilament.form.name_placeholdertranslationfilament.fields_help.densitytranslationDesign Decisions
dropdownRenderpattern from location select (lines 450-465 in spools/create.tsx)useInvalidatehook instead of trying to refetch queries directlyTesting Checklist
Priority
Highest - biggest UX win