Skip to content

Conversation

@google-labs-jules
Copy link
Contributor

Fixes #34


PR created automatically by Jules for task 6457327844237072953

This commit introduces a DOM pruning mechanism to the infinite scroll feature for displaying vocabulary lists.

Previously, as the user scrolled, new table rows were continuously added to the DOM, but old rows that scrolled out of view were never removed. This led to an ever-growing number of DOM elements, causing significant performance degradation and crashes on memory-constrained devices like older iPads, especially when displaying more than 80-100 rows.

This change addresses the issue by:
1.  Introducing a `MAX_ROWS_IN_DOM` constant to limit the total number of `<tr>` elements that can exist in the DOM at any given time.
2.  Adding a `pruneOffscreenRows` function that removes rows from the top or bottom of the table when the total number of rows exceeds the defined limit.
3.  Updating the `scrollHandler` to call this pruning function after new rows are added, ensuring the DOM size remains small and constant, thus improving performance and preventing crashes.
4.  Adding a global tracker `g_currentlyRendered` to keep track of the rendered data slice.
@google-labs-jules
Copy link
Contributor Author

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll acknowledge your comments with a 👀 emoji and then get to work. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

I will automatically address your feedback. For any comments you don't want me to act on, just include (aside).



For security, I will only act on instructions from the user who triggered this task for this pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

舊个 iOS 裝置在繪製較多行个表格時節,分頁會壞核

1 participant