-
Notifications
You must be signed in to change notification settings - Fork 135
fix: restore legacy path compatibility regressions #96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -89,8 +89,46 @@ function shouldSkipNodeAssignment(node: Node, nodeCallback: ObjectToFormNodeCall | |
| } | ||
|
|
||
| function normalizeName(name: string, delimiter: string, arrayIndexes: ArrayIndexesMap): string { | ||
| let nameToNormalize = name; | ||
| const rawChunks = name.split(delimiter); | ||
| const normalizedRawChunks: string[] = []; | ||
|
|
||
| for (const rawChunk of rawChunks) { | ||
| const bracketMatches = Array.from(rawChunk.matchAll(/\[([^\]]*)\]/g)); | ||
| if (bracketMatches.length === 0) { | ||
| normalizedRawChunks.push(rawChunk); | ||
| continue; | ||
| } | ||
|
|
||
| let currentChunk = rawChunk.slice(0, bracketMatches[0]?.index ?? 0); | ||
|
|
||
| for (const match of bracketMatches) { | ||
cubic-dev-ai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| const bracketContent = match[1] ?? ""; | ||
| const isArraySegment = bracketContent === "" || /^\d+$/.test(bracketContent); | ||
|
|
||
| if (isArraySegment) { | ||
| currentChunk = `${currentChunk}[${bracketContent}]`; | ||
|
Comment on lines
+117
to
+125
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Useful? React with 👍 / 👎.
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Valid issue. Fixed in |
||
| continue; | ||
| } | ||
|
|
||
| if (currentChunk !== "") { | ||
| normalizedRawChunks.push(currentChunk); | ||
| } | ||
|
|
||
| currentChunk = bracketContent; | ||
| } | ||
|
|
||
| if (currentChunk !== "") { | ||
| normalizedRawChunks.push(currentChunk); | ||
| } | ||
| } | ||
|
|
||
| if (normalizedRawChunks.length > 0) { | ||
| nameToNormalize = normalizedRawChunks.join(delimiter); | ||
| } | ||
|
|
||
| const normalizedNameChunks: string[] = []; | ||
| const chunks = name.replace(ARRAY_OF_ARRAYS_REGEXP, "[$1].[$2]").split(delimiter); | ||
| const chunks = nameToNormalize.replace(ARRAY_OF_ARRAYS_REGEXP, "[$1].[$2]").split(delimiter); | ||
|
|
||
| for (let chunkIndex = 0; chunkIndex < chunks.length; chunkIndex += 1) { | ||
| const currentChunk = chunks[chunkIndex] ?? ""; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.