FieldValues: Use plain arrays instead of Vector (part 3 of 2) (#66612)

Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
This commit is contained in:
Leon Sorokin
2023-04-20 17:59:18 +03:00
committed by GitHub
co-authored by Ryan McKinley
parent 24696d593b
commit b24ba7b7ae
109 changed files with 594 additions and 648 deletions
@@ -21,7 +21,7 @@ export function StorageFolderPage(props: Props) {
const renderListing = () => {
if (listing.value) {
const names = listing.value.fields[0].values.toArray();
const names = listing.value.fields[0].values;
return names.map((item: string) => {
let name = item;
const isFolder = name.indexOf('.') < 0;
+3 -8
View File
@@ -68,7 +68,7 @@ export default function StoragePage(props: Props) {
frame.fields[0] = {
...name,
getLinks: (cfg: ValueLinkConfig) => {
const n = name.values.get(cfg.valueRowIndex ?? 0);
const n = name.values[cfg.valueRowIndex ?? 0];
const p = path + '/' + n;
return [
{
@@ -93,7 +93,7 @@ export default function StoragePage(props: Props) {
if (listing.value) {
const length = listing.value.length;
if (length === 1) {
const first = listing.value.fields[0].values.get(0) as string;
const first = listing.value.fields[0].values[0] as string;
isFolder = !path.endsWith(first);
} else {
// TODO: handle files/folders which do not exist
@@ -104,12 +104,7 @@ export default function StoragePage(props: Props) {
}, [path, listing]);
const fileNames = useMemo(() => {
return (
listing.value?.fields
?.find((f) => f.name === 'name')
?.values?.toArray()
?.filter((v) => typeof v === 'string') ?? []
);
return listing.value?.fields?.find((f) => f.name === 'name')?.values.filter((v) => typeof v === 'string') ?? [];
}, [listing]);
const renderView = () => {