Dashboard country detail page does not show or save Region custom fields
Describe the bug
Custom fields for a country are configured under Region. In the dashboard, the country detail page neither shows these custom fields nor saves them.
The detail query already treats Country as an alias of Region when it adds the custom fields selection (packages/dashboard/src/lib/framework/document-introspection/add-custom-fields.ts), so the values are loaded. useCustomFieldConfig (packages/dashboard/src/lib/hooks/use-custom-field-config.ts) has no such alias: it looks up entityCustomFields by the literal name Country and finds nothing.
That one lookup feeds CustomFieldsPageBlock, CustomFieldsForm and useDetailPage, which gives two symptoms:
CustomFieldsPageBlock entityType="Country"gets an empty config and renders nothing.useDetailPagepasses the same empty config toremoveReadonlyAndLocalizedCustomFields, so every custom field is dropped from the update input.
To Reproduce
- Add a custom field to
Region(see the configuration below). - Open the dashboard, go to Settings → Countries and open any country.
- There is no custom fields block on the page.
- Change the country name and save. The
updateCountryinput containscustomFields: {}.
Expected behavior
The country detail page shows the custom fields configured for Region, and saving the page sends their values.
Actual behavior
No custom fields are shown. A value set through the Admin API cannot be seen or edited in the dashboard. The save succeeds and reports success, with an empty customFields object.
Environment (please complete the following information):
- @vendure/core version: 3.7.3 (
@vendure/dashboard3.7.3); the code is unchanged onmaster - Nodejs version: 22.21.1
- Database (mysql/postgres etc): postgres
- Operating System (Windows/macOS/Linux): macOS
- Browser (if applicable): Chromium
- Package manager (npm/yarn/pnpm): npm
Configuration
customFields: {
Region: [{ name: 'regionCode', type: 'string', nullable: true }],
},Workaround
Patch useCustomFieldConfig so that Country resolves to Region:
const entityName = entityType === 'Country' ? 'Region' : entityType;
const customFieldConfig = serverConfig.entityCustomFields.find(field => field.entityName === entityName);Additional context
It happens consistently. #5449 applies the alias above and adds a spec for it.
Source: vendurehq/vendure