Add support for nested property names of same value#40
Open
Add support for nested property names of same value#40
Conversation
There was a problem hiding this comment.
Pull request overview
Adds support for disambiguating same-named fields that exist at different nesting levels (notably within collections) by allowing ui.fields entries to be resolved via qualified IDs (e.g., sightings.name) instead of only local property names.
Changes:
- Extend
createControl/generateCollectionUISchemaInternalto propagate and use acollectionIdso collection-itemui.fieldscan be resolved via qualified IDs. - Update V2 mock schema data to match the new server format using qualified field IDs for collection item fields.
- Add a unit test covering the collision scenario (top-level
namevs.sightings[].name).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| test/v2.test.ts | Adds a regression test validating correct resolution of same-named fields via qualified IDs. |
| src/v2/utils.ts | Implements qualified-id lookup for collection item UI field configuration and propagates collectionId for nested collections. |
| src/v2/mockData.ts | Updates mock V2 schema ui.fields and collection column entries to use qualified IDs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+383
to
+389
| const collectionLocalName = collectionId.split(".").pop()!; | ||
| const itemUiField = | ||
| schema.ui.fields[qualifiedId] ?? | ||
| (fallbackField?.parent === collectionId || | ||
| fallbackField?.parent === collectionLocalName | ||
| ? fallbackField | ||
| : undefined); |
Comment on lines
+107
to
+110
| const effectiveId = collectionId ?? fieldName; | ||
| const prefix = `${effectiveId}.`; | ||
| control.options!.itemIdentifier = uiField.itemIdentifier.startsWith(prefix) | ||
| ? uiField.itemIdentifier.slice(prefix.length) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds support for #39
Proposed Changes
src/v2/utils.ts
createControlcollectionId?: stringparametergenerateCollectionUISchemaInternalcollectionId: stringparametersrc/v2/mockData.ts
v2.test.ts
ui.fieldsentry via the qualified IDImplementation Test
In React Native client app, e.g. EarthRanger
Unit Tests