|
52 | 52 | * same skips, same rule id: the two surfaces agree on what counts as a field by |
53 | 53 | * construction rather than by two lists that happen to match, which is the |
54 | 54 | * drift #4330 had just finished removing from the system-field lists. |
| 55 | + * |
| 56 | + * ── Stored page sorts are not read here (#30093) ───────────────────────── |
| 57 | + * |
| 58 | + * A page `sort` is not a binding a renderer skips: it lowers into the list |
| 59 | + * door's ORDER BY, which answers an unknown name `400 INVALID_SORT` on the |
| 60 | + * first load and every load after it. So every page sort slot (a component's |
| 61 | + * `dataSource.sort`, a related list's `sort` and `parentDataSource.sort`, each |
| 62 | + * sort-carrying block's own `sort`, `interfaceConfig.sort`, an app page's |
| 63 | + * `record.sort`) is judged by `validateSortableFields`, under this family's |
| 64 | + * ids: `page-field-unknown` at `error`, `page-field-unprovisioned` at |
| 65 | + * `warning`. That member is the one the page publish door runs, so the miss |
| 66 | + * refuses the save instead of publishing a page that breaks on its first read. |
| 67 | + * Until #30093 this walk read two of those slots at `warning` and the rest |
| 68 | + * were read by nothing. The react surface's sort props are not page metadata |
| 69 | + * slots and keep their own reading in `validate-react-page-props`. |
55 | 70 | */ |
56 | 71 |
|
57 | 72 | export const PAGE_FIELD_UNKNOWN = 'page-field-unknown'; |
@@ -600,6 +615,20 @@ export function checkFieldRefs( |
600 | 615 | return findings; |
601 | 616 | } |
602 | 617 |
|
| 618 | +/** |
| 619 | + * [#30093] Is `ref` one a related list's `sort` prop yielded? A STORED page |
| 620 | + * sort lowers into the list door's ORDER BY, which answers an unknown name |
| 621 | + * `400 INVALID_SORT` on every load, so it is not the `skipped` miss this pass |
| 622 | + * grades: `validateSortableFields` asks every page sort slot existence, |
| 623 | + * provenance and sortability, under this family's ids, and it is the member the |
| 624 | + * page publish door runs. {@link relatedListFieldRefs} keeps yielding the |
| 625 | + * sort refs for its out-of-repo callers; only this walk sets them aside. |
| 626 | + */ |
| 627 | +function isPageSortRef(ref: FieldRef, propsPath: string): boolean { |
| 628 | + const sortPath = `${propsPath}.sort`; |
| 629 | + return ref.path === sortPath || ref.path.startsWith(`${sortPath}[`) || ref.path.startsWith(`${sortPath}.`); |
| 630 | +} |
| 631 | + |
603 | 632 | export function validatePageFieldBindings(stack: AnyRec): PageFieldFinding[] { |
604 | 633 | const findings: PageFieldFinding[] = []; |
605 | 634 | if (!stack || typeof stack !== 'object') return findings; |
@@ -643,7 +672,14 @@ export function validatePageFieldBindings(stack: AnyRec): PageFieldFinding[] { |
643 | 672 | // parent; without it, `properties.objectName` names the child. |
644 | 673 | const split = relatedListFieldRefs(props, base); |
645 | 674 | const dataSource = isRec(component.dataSource) ? component.dataSource : undefined; |
646 | | - checkRefs(split.related, strName(dataSource?.object) ?? split.relatedObject, where); |
| 675 | + // [#30093] The list's `sort` is a stored page sort, judged by |
| 676 | + // `validateSortableFields` at the list door's grade (see |
| 677 | + // {@link isPageSortRef}); every other child-side ref stays here. |
| 678 | + checkRefs( |
| 679 | + split.related.filter((ref) => !isPageSortRef(ref, base)), |
| 680 | + strName(dataSource?.object) ?? split.relatedObject, |
| 681 | + where, |
| 682 | + ); |
647 | 683 | // `relationshipValueField` names a field on the PARENT — the record the |
648 | 684 | // list hangs off, never its own child `dataSource`. The parent is the |
649 | 685 | // list's own `parentDataSource.object` when it declares one (ruling B on |
@@ -690,9 +726,10 @@ export function validatePageFieldBindings(stack: AnyRec): PageFieldFinding[] { |
690 | 726 | if (cfg) { |
691 | 727 | const cfgObject = strName(cfg.source) ?? strName(page.object); |
692 | 728 | const base = `pages[${pi}].interfaceConfig`; |
| 729 | + // [#30093] `cfg.sort` is a stored page sort: `validateSortableFields` |
| 730 | + // judges it, at the list door's grade. |
693 | 731 | const refs: FieldRef[] = [ |
694 | 732 | ...fieldRefsFrom(cfg.columns, `${base}.columns`), |
695 | | - ...sortFieldRefs(cfg.sort, `${base}.sort`), |
696 | 733 | ...filterFieldRefs(cfg.filterBy, `${base}.filterBy`), |
697 | 734 | ]; |
698 | 735 | const userFilters = isRec(cfg.userFilters) ? cfg.userFilters : undefined; |
|
0 commit comments