feat: fix junction toggle persistence and add type-safe documentation paths (#17421)
## Summary - **Fix junction relation toggle not being saved**: The form schema wasn't tracking the `settings` field, so changes to `junctionTargetFieldId` weren't marked as dirty - **Add type-safe documentation paths**: Generate TypeScript constants from `base-structure.json` to prevent broken documentation links - **Create many-to-many relations documentation**: Step-by-step guide for building many-to-many relations using junction objects - **Update `getDocumentationUrl`**: Now uses shared constants from `twenty-shared` for base URL, default path, and supported languages ## Key Changes ### Junction Toggle Fix - Added `settings` field to the form schema in `SettingsDataModelFieldRelationForm.tsx` - Fixed the toggle to properly merge settings when updating `junctionTargetFieldId` ### Type-Safe Documentation Paths - New constants in `twenty-shared/constants`: - `DOCUMENTATION_PATHS` - All 161 documentation paths as typed constants - `DOCUMENTATION_SUPPORTED_LANGUAGES` - 14 supported languages - `DOCUMENTATION_BASE_URL` / `DOCUMENTATION_DEFAULT_PATH` - Generator script: `yarn docs:generate-paths` - CI integration: Added to `docs-i18n-pull.yaml` workflow ### Documentation - New article: `/user-guide/data-model/how-tos/create-many-to-many-relations` - Updated `/user-guide/data-model/capabilities/relation-fields.mdx` with Lab warning and link ## Test plan - [ ] Verify junction toggle saves correctly when enabled/disabled - [ ] Verify documentation link opens correct localized page - [ ] Verify `yarn docs:generate-paths` regenerates paths correctly
This commit is contained in:
@@ -37,12 +37,16 @@ Many records in Object A can be linked to many records in Object B.
|
||||
|
||||
**Example:** Many People can be linked to many Projects, and vice versa.
|
||||
|
||||
<Warning>
|
||||
**Many-to-Many is not yet supported.**
|
||||
Many-to-many relations use a **junction object** pattern: an intermediate object that connects both sides. With the junction relation feature, Twenty displays the final linked records directly, hiding the intermediate object from the UI.
|
||||
|
||||
This relation type is planned for H1 2026. As a workaround, create an intermediate "junction" object (e.g., "Project Assignments") that has Many-to-One relations to both objects.
|
||||
<img src="/images/user-guide/fields/junction-relation-diagram.png" style={{width:'100%'}}/>
|
||||
|
||||
<Warning>
|
||||
**Lab Feature**: Junction relations must be enabled at **Settings → Updates → Lab** before use.
|
||||
</Warning>
|
||||
|
||||
See [How to Create Many-to-Many Relations](/user-guide/data-model/how-tos/create-many-to-many-relations) for a complete step-by-step guide.
|
||||
|
||||
## Creating a Relation Field
|
||||
|
||||
1. Go to **Settings → Data Model**
|
||||
|
||||
Reference in New Issue
Block a user