mirror of
https://github.com/estruyf/vscode-front-matter.git
synced 2026-03-28 17:42:40 +01:00
Issue: Content relationship field type is fetching forever #885
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
- [#859](https://github.com/estruyf/vscode-front-matter/issues/859): Fix label in the data view dropdown field
|
||||
- [#876](https://github.com/estruyf/vscode-front-matter/issues/876): Fix snippet type on the snippet card
|
||||
- [#879](https://github.com/estruyf/vscode-front-matter/issues/879): Fix for auto updating last modified date on save
|
||||
- [#885](https://github.com/estruyf/vscode-front-matter/issues/885): Fix content relationship for none i18n content
|
||||
|
||||
## [10.5.1] - 2024-10-23
|
||||
|
||||
|
||||
@@ -39,8 +39,9 @@ export class FieldsListener extends BaseListener {
|
||||
return;
|
||||
}
|
||||
|
||||
const isLocaleEnabled = await i18n.isLocaleEnabled(data.activePath);
|
||||
const activeLocale = await i18n.getLocale(data.activePath);
|
||||
if (!activeLocale?.locale) {
|
||||
if (isLocaleEnabled && !activeLocale?.locale) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -48,7 +49,7 @@ export class FieldsListener extends BaseListener {
|
||||
const fuseOptions: Fuse.IFuseOptions<Page> = {
|
||||
keys: [
|
||||
{ name: 'fmContentType', weight: 1 },
|
||||
...(data.sameLocale ? [{ name: 'fmLocale.locale', weight: 1 }] : [])
|
||||
...(isLocaleEnabled && data.sameLocale ? [{ name: 'fmLocale.locale', weight: 1 }] : [])
|
||||
],
|
||||
findAllMatches: true,
|
||||
threshold: 0
|
||||
@@ -62,8 +63,10 @@ export class FieldsListener extends BaseListener {
|
||||
const fuse = new Fuse(pages || [], fuseOptions, fuseIndex);
|
||||
const results = fuse.search({
|
||||
$and: [
|
||||
{ fmContentType: data.type! },
|
||||
...(data.sameLocale ? [{ 'fmLocale.locale': activeLocale.locale }] : [])
|
||||
{ fmContentType: data.type ?? '' },
|
||||
...(isLocaleEnabled && activeLocale?.locale && data.sameLocale
|
||||
? [{ 'fmLocale.locale': activeLocale.locale }]
|
||||
: [])
|
||||
]
|
||||
});
|
||||
const pageResults = results.map((page) => page.item);
|
||||
|
||||
Reference in New Issue
Block a user