Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: Cannot read properties of undefined (reading 'entries') #34

Closed
adamtaylor13 opened this issue Nov 4, 2023 · 2 comments
Closed
Labels
bug Something isn't working

Comments

@adamtaylor13
Copy link

Bug description A clear and concise description of what the bug is.
It appears there's a strange interaction between height and the number of data entries in the table.

Expected behavior What you expected to happen instead.
I'd expect the table to set empty rows if the amount of data cannot fill the height.

Reproduction Code to reproduce the behavior (optional).

import { Tui } from "https://deno.land/x/tui@2.1.4/mod.ts";
import { Table } from "https://deno.land/x/tui@2.1.4/src/components/mod.ts";
import { crayon } from "https://deno.land/x/crayon@3.3.3/mod.ts";

const tui = new Tui({
    style: crayon.bgBlack, // Make background black
    refreshRate: 1000 / 60, // Run in 60FPS
});

tui.dispatch(); // Close Tui on CTRL+C
tui.run();

const data = [
    ["0", "Data 0"],
    ["1", "Data 1"],
]

new Table({
    parent: tui,
    theme: {
        base: crayon.bgBlack.white,
        frame: { base: crayon.bgBlack },
        header: { base: crayon.bgBlack.bold.lightBlue },
        selectedRow: {
            base: crayon.bold.bgBlue.white,
            focused: crayon.bold.bgLightBlue.white,
            active: crayon.bold.bgMagenta.black,
        },
    },
    rectangle: {
        column: 1,
        row: 1,
        height: 10, // NOTE: If I change this to data.length + 4, it appears to be pretty robust. But if the height >= data.length + 5; you'll see this error. So for example, 1, 2, etc all the way to 6 is fine for this example. But if you make it 7+, it will throw this error.
    },
    headers: [
        { title: "ID" },
        { title: "Name" }
    ],
    data,
    charMap: "rounded",
    zIndex: 0,
});

Screenshots Screenshots to help explain your problem (optional).

Information (please complete)

  • OS: macOS
  • Deno version:
╰ $ deno --version
deno 1.33.2 (release, aarch64-apple-darwin)
v8 11.4.183.1
typescript 5.0.3
@adamtaylor13 adamtaylor13 added the bug Something isn't working label Nov 4, 2023
@Im-Beast
Copy link
Owner

Im-Beast commented Nov 4, 2023

Hi!
Thank you for the bug report.
I've fixed it, you should be able to use version 2.1.5 from now on without this issue happening.
In case issue persists, feel free to reopen this issue!

@Im-Beast Im-Beast closed this as completed Nov 4, 2023
@adamtaylor13
Copy link
Author

Wow! Very quick fix. Thanks so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants