Insert document title when pasting internal doc url (#6352)
* refactor * DRY
This commit is contained in:
@@ -180,6 +180,13 @@ export default class DocumentsStore extends Store<Document> {
|
||||
return naturalSort(this.inCollection(collectionId), "title");
|
||||
}
|
||||
|
||||
get(id: string): Document | undefined {
|
||||
return (
|
||||
this.data.get(id) ??
|
||||
this.orderedData.find((doc) => id.endsWith(doc.urlId))
|
||||
);
|
||||
}
|
||||
|
||||
@computed
|
||||
get archived(): Document[] {
|
||||
return orderBy(this.orderedData, "archivedAt", "desc").filter(
|
||||
|
||||
@@ -219,7 +219,7 @@ export default abstract class Store<T extends Model> {
|
||||
throw new Error(`Cannot fetch ${this.modelName}`);
|
||||
}
|
||||
|
||||
const item = this.data.get(id);
|
||||
const item = this.get(id);
|
||||
if (item && !options.force) {
|
||||
return item;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user