Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Add Virtualization Support for Large JSON Objects

オープン
#82 コメント 1 件 リアクション 2 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
35/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
react, typescript

調査の方向性

Start at the JsonView component entry point and reproduce the 5,000-key example with the listed React and package versions while recording initial render and scrolling performance. Compare the proposed virtualization approaches, then define completion against the expected behavior: only visible nodes render, scrolling remains smooth, memory does not grow with object size, and initial rendering is fast.

索引モデルが issue の本文から書いたものです。

説明

Problem Description

When rendering large JSON objects (e.g., 1000+ keys or deeply nested structures), the component causes significant performance degradation, making the page laggy and unresponsive. All DOM nodes are rendered immediately, even those not visible in the viewport.

Current Behavior

  • All JSON nodes are rendered to the DOM immediately
  • Large objects (1000+ keys) cause noticeable UI lag
  • Scrolling becomes janky with large datasets
  • Memory usage increases linearly with object size
  • Browser can become unresponsive during initial render

Expected Behavior

  • Only visible nodes should be rendered (windowing/virtualization)
  • Smooth scrolling regardless of JSON size
  • Constant memory usage regardless of object size
  • Fast initial render time

Minimal Reproduction

import JsonView from '@uiw/react-json-view';
import { useState, useEffect } from 'react';

function App() {
  const [largeObject, setLargeObject] = useState({});

  useEffect(() => {
    // Generate a large object with 5000 keys
    const obj: Record<string, any> = {};
    
    for (let i = 0; i < 5000; i++) {
      obj[`key_${i}`] = {
        id: i,
        name: `Item ${i}`,
        description: `Description for item ${i}`,
        metadata: {
          created: new Date().toISOString(),
          modified: new Date().toISOString(),
          tags: ['tag1', 'tag2', 'tag3'],
          nested: {
            level1: {
              level2: {
                level3: {
                  data: `Deep nested data ${i}`
                }
              }
            }
          }
        }
      };
    }
    
    setLargeObject(obj);
  }, []);

  return (
    <div style={{ height: '100vh', padding: '20px' }}>
      <h1>Large JSON Performance Test</h1>
      <p>Object size: {Object.keys(largeObject).length} keys</p>
      
      <div style={{ height: 'calc(100vh - 100px)', overflow: 'auto', border: '1px solid #ccc' }}>
        <JsonView
          value={largeObject}
          displayDataTypes={false}
          displayObjectSize={false}
          collapsed={1} // Collapse by default
        />
      </div>
    </div>
  );
}

export default App;
Steps to Reproduce
  1. Create a new React app with @uiw/[email protected]
  2. Use the above code example
  3. Open browser DevTools Performance tab
  4. Start recording and wait for component to render
  5. Try scrolling through the JSON view

Proposed Solution

Implement virtualization using one of these approaches:

Option 1: React Window / React Virtual

Use a proven virtualization library to render only visible nodes:

import { FixedSizeList } from 'react-window';

// Pseudo-code example
<FixedSizeList
  height={600}
  itemCount={visibleNodes.length}
  itemSize={24}
  width="100%"
>
  {({ index, style }) => (
    <div style={style}>
      <JsonNode node={visibleNodes[index]} />
    </div>
  )}
</FixedSizeList>
Option 2: Custom Virtualization

Implement a custom windowing solution that:

  1. Tracks scroll position
  2. Calculates visible range of nodes
  3. Renders only nodes within viewport + buffer
  4. Maintains proper scroll height with padding elements

Benefits

  • ✅ Handles objects with 10,000+ keys smoothly
  • ✅ Constant memory usage regardless of JSON size
  • ✅ 60 FPS scrolling performance
  • ✅ Fast initial render (< 100ms)
  • ✅ Better user experience for data-heavy applications

Environment

  • Package version: @uiw/[email protected]
  • React version: ^18.3.1
  • Browser: Chrome 131, Firefox 133, Safari 18
  • OS: macOS, Windows, Linux

Additional Context

Many similar libraries have implemented virtualization:

Workarounds Currently Used

  1. Pagination: Breaking large objects into smaller chunks (poor UX)
  2. Lazy loading on expand: Loading children only when expanded (complex state management)
  3. Limiting display: Only showing first N items (data loss)
  4. External viewers: Opening in separate tools (context switching)

None of these are ideal solutions compared to built-in virtualization.


Would love to see virtualization support in this library! Happy to contribute to implementation if you'd like to provide guidance on the preferred approach. 🚀

主要言語
TypeScript
スター
420
フォーク
24
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

uiwjs/react-json-view のほかの issue

uiwjs/react-json-view の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。