Fix flicker when remapping imported notetype field (#2005)

This commit is contained in:
RumovZ 2022-08-07 17:01:25 +02:00 committed by GitHub
parent a338271d55
commit 4ea370959b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -13,10 +13,21 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
export let columnOptions: ColumnOption[]; export let columnOptions: ColumnOption[];
export let tagsColumn: number; export let tagsColumn: number;
export let globalNotetype: ImportExport.CsvMetadata.MappedNotetype | null; export let globalNotetype: ImportExport.CsvMetadata.MappedNotetype | null;
let lastNotetypeId: number | undefined = -1;
let fieldNamesPromise: Promise<string[]>;
$: if (globalNotetype?.id !== lastNotetypeId) {
lastNotetypeId = globalNotetype?.id;
fieldNamesPromise =
globalNotetype === null
? Promise.resolve([])
: getNotetypeFields(globalNotetype.id);
}
</script> </script>
{#if globalNotetype} {#if globalNotetype}
{#await getNotetypeFields(globalNotetype.id) then fieldNames} {#await fieldNamesPromise then fieldNames}
{#each fieldNames as label, idx} {#each fieldNames as label, idx}
<!-- first index is treated specially, because it must be assigned some column --> <!-- first index is treated specially, because it must be assigned some column -->
<MapperRow <MapperRow