From fddac687934db4421adc16496beaee111b2d5c71 Mon Sep 17 00:00:00 2001 From: bobzel Date: Fri, 24 Mar 2023 23:45:33 -0400 Subject: from last --- .../collections/collectionSchema/CollectionSchemaView.tsx | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx b/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx index f5d3243f4..60202a19e 100644 --- a/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx +++ b/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx @@ -793,7 +793,7 @@ export class CollectionSchemaView extends CollectionSubView() { @computed get sortedDocs() { const field = StrCast(this.layoutDoc.sortField); const desc = BoolCast(this.layoutDoc.sortDesc); - return !field + const docs = !field ? this.childDocs : this.childDocs.sort((docA, docB) => { const aStr = Field.toString(docA[field] as Field); @@ -804,6 +804,7 @@ export class CollectionSchemaView extends CollectionSubView() { if (desc) out *= -1; return out; }); + return { docs }; } sortedDocsFunc = () => this.sortedDocs; isContentActive = () => this.props.isSelected() || this.props.isContentActive(); @@ -853,7 +854,7 @@ export class CollectionSchemaView extends CollectionSubView() { {this._columnMenuIndex !== undefined && this.renderColumnMenu} {this._filterColumnIndex !== undefined && this.renderFilterMenu} - + @@ -899,9 +900,7 @@ export class CollectionSchemaView extends CollectionSubView() { interface CollectionSchemaViewDocsProps { schema: CollectionSchemaView; - childDocs: () => Doc[]; - sortField: string; // I don't know why these are needed since the childDocs function changes when the sort changes. However, for some reason that doesn't cause a re-render... - sortDesc: boolean; + childDocs: () => { docs: Doc[] }; } @observer @@ -911,7 +910,7 @@ class CollectionSchemaViewDocs extends React.Component - {this.props.childDocs().map((doc: Doc, index: number) => { + {this.props.childDocs().docs.map((doc: Doc, index: number) => { const dataDoc = !doc.isTemplateDoc && !doc.isTemplateForField ? undefined : this.props.schema.props.DataDoc; return (
-- cgit v1.2.3-70-g09d2