Skip to content

Bug: Item height validation false positives #786

@OliverJAsh

Description

@OliverJAsh

Prerequisites

Describe the issue

When using CodeView and __devOnlyValidateItemHeights, on page load we see these console errors:

Image

Reproduction

https://stackblitz.com/edit/vitejs-vite-tfbdr1ha?file=src%2FApp.tsx&terminal=dev

import { CodeView } from "@pierre/diffs/react";
import { parseDiffFromFile, type CodeViewDiffItem } from "@pierre/diffs";

const exampleItem: CodeViewDiffItem = {
  id: "foo",
  type: "diff",
  fileDiff: parseDiffFromFile(
    {
      name: "greeting.ts",
      contents: 'export const greeting = "Hello";',
    },
    {
      name: "greeting.ts",
      contents: 'export const greeting = "Hello, World!";',
    },
  ),
};

function App() {
  return (
    <CodeView
      items={[exampleItem]}
      style={{ height: 600, overflow: "auto" }}
      options={{
        __devOnlyValidateItemHeights: true,
      }}
    />
  );
}

export default App;

What browser(s) are you seeing the problem on?

Chrome

What version of @pierre/diffs are you using?

1.2.7

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdiffs

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions