{ "issue": { "url": "https://api.github.com/repos/laurent22/joplin/issues/6469", "repository_url": "https://api.github.com/repos/laurent22/joplin", "labels_url": "https://api.github.com/repos/laurent22/joplin/issues/6469/labels{/name}", "comments_url": "https://api.github.com/repos/laurent22/joplin/issues/6469/comments", "events_url": "https://api.github.com/repos/laurent22/joplin/issues/6469/events", "html_url": "https://github.com/laurent22/joplin/pull/6469", "id": 1221980499, "node_id": "PR_kwDOBLftOs43HvjR", "number": 6469, "title": "Desktop: Performance: Reduces re-rendering of NoteEditor and loading of resourceInfo ", "user": { "login": "ken1kob", "id": 16041683, "node_id": "MDQ6VXNlcjE2MDQxNjgz", "avatar_url": "https://avatars.githubusercontent.com/u/16041683?v=4", "gravatar_id": "", "url": "https://api.github.com/users/ken1kob", "html_url": "https://github.com/ken1kob", "followers_url": "https://api.github.com/users/ken1kob/followers", "following_url": "https://api.github.com/users/ken1kob/following{/other_user}", "gists_url": "https://api.github.com/users/ken1kob/gists{/gist_id}", "starred_url": "https://api.github.com/users/ken1kob/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/ken1kob/subscriptions", "organizations_url": "https://api.github.com/users/ken1kob/orgs", "repos_url": "https://api.github.com/users/ken1kob/repos", "events_url": "https://api.github.com/users/ken1kob/events{/privacy}", "received_events_url": "https://api.github.com/users/ken1kob/received_events", "type": "User", "user_view_type": "public", "site_admin": false }, "labels": [ { "id": 1080341216, "node_id": "MDU6TGFiZWwxMDgwMzQxMjE2", "url": "https://api.github.com/repos/laurent22/joplin/labels/desktop", "name": "desktop", "color": "ffc274", "default": false, "description": "All desktop platforms" } ], "state": "closed", "locked": true, "assignee": null, "assignees": [], "milestone": null, "comments": 4, "created_at": "2022-05-01T02:03:01Z", "updated_at": "2023-11-19T10:49:06Z", "closed_at": "2023-11-19T10:49:00Z", "author_association": "CONTRIBUTOR", "sub_issues_summary": { "total": 0, "completed": 0, "percent_completed": 0 }, "active_lock_reason": "resolved", "draft": false, "pull_request": { "url": "https://api.github.com/repos/laurent22/joplin/pulls/6469", "html_url": "https://github.com/laurent22/joplin/pull/6469", "diff_url": "https://github.com/laurent22/joplin/pull/6469.diff", "patch_url": "https://github.com/laurent22/joplin/pull/6469.patch", "merged_at": null }, "body": "This PR is one of PRs resolving issue #6386.\r\n\r\nThis PR suppresses redundant re-rendering of NoteEditor caused by ResourceInfos and redundant loading of ResourceInfos.\r\n\r\n### Cause\r\n\r\nWhen a new note is selected, a new FormNote instance is created. In NoteEditor/utils/useFormNote.ts, the following four parts have loading ResouceInfos and updating a useState variable.\r\n\r\n- (a) FormNote initialization (in useEffect)\r\n- (b) Change of FormNote.id (in useEffect)\r\n- (c) Change of FormNote.body (in useEffect)\r\n- (d) `onResourceChange` useCallback\r\n\r\nWhen a new FormNote instance is initialized, (a), (b) and (c) are executed. So, two redundant loading happen, and caching doesn't work in (a) and (b). Besides, redundant re-rendering of NoteEditor possibly happens.\r\n\r\n### Treatment\r\n\r\nThe belows are treatments to prevent redundant re-loading and re-rendering.\r\n- id and body information (`resourceInfosDesc`) is tied to `resourceInfos`.\r\n- (b) and (c) are merged into one useEffect.", "closed_by": { "login": "laurent22", "id": 1285584, "node_id": "MDQ6VXNlcjEyODU1ODQ=", "avatar_url": "https://avatars.githubusercontent.com/u/1285584?v=4", "gravatar_id": "", "url": "https://api.github.com/users/laurent22", "html_url": "https://github.com/laurent22", "followers_url": "https://api.github.com/users/laurent22/followers", "following_url": "https://api.github.com/users/laurent22/following{/other_user}", "gists_url": "https://api.github.com/users/laurent22/gists{/gist_id}", "starred_url": "https://api.github.com/users/laurent22/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/laurent22/subscriptions", "organizations_url": "https://api.github.com/users/laurent22/orgs", "repos_url": "https://api.github.com/users/laurent22/repos", "events_url": "https://api.github.com/users/laurent22/events{/privacy}", "received_events_url": "https://api.github.com/users/laurent22/received_events", "type": "User", "user_view_type": "public", "site_admin": false }, "reactions": { "url": "https://api.github.com/repos/laurent22/joplin/issues/6469/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 }, "timeline_url": "https://api.github.com/repos/laurent22/joplin/issues/6469/timeline", "performed_via_github_app": null, "state_reason": null }, "comments": [ { "url": "https://api.github.com/repos/laurent22/joplin/issues/comments/1361674322", "html_url": "https://github.com/laurent22/joplin/pull/6469#issuecomment-1361674322", "issue_url": "https://api.github.com/repos/laurent22/joplin/issues/6469", "id": 1361674322, "node_id": "IC_kwDOBLftOs5RKYBS", "user": { "login": "laurent22", "id": 1285584, "node_id": "MDQ6VXNlcjEyODU1ODQ=", "avatar_url": "https://avatars.githubusercontent.com/u/1285584?v=4", "gravatar_id": "", "url": "https://api.github.com/users/laurent22", "html_url": "https://github.com/laurent22", "followers_url": "https://api.github.com/users/laurent22/followers", "following_url": "https://api.github.com/users/laurent22/following{/other_user}", "gists_url": "https://api.github.com/users/laurent22/gists{/gist_id}", "starred_url": "https://api.github.com/users/laurent22/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/laurent22/subscriptions", "organizations_url": "https://api.github.com/users/laurent22/orgs", "repos_url": "https://api.github.com/users/laurent22/repos", "events_url": "https://api.github.com/users/laurent22/events{/privacy}", "received_events_url": "https://api.github.com/users/laurent22/received_events", "type": "User", "user_view_type": "public", "site_admin": false }, "created_at": "2022-12-21T17:01:50Z", "updated_at": "2022-12-21T17:01:50Z", "author_association": "OWNER", "body": "recheck", "reactions": { "url": "https://api.github.com/repos/laurent22/joplin/issues/comments/1361674322/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 }, "performed_via_github_app": null }, { "url": "https://api.github.com/repos/laurent22/joplin/issues/comments/1361674655", "html_url": "https://github.com/laurent22/joplin/pull/6469#issuecomment-1361674655", "issue_url": "https://api.github.com/repos/laurent22/joplin/issues/6469", "id": 1361674655, "node_id": "IC_kwDOBLftOs5RKYGf", "user": { "login": "github-actions[bot]", "id": 41898282, "node_id": "MDM6Qm90NDE4OTgyODI=", "avatar_url": "https://avatars.githubusercontent.com/in/15368?v=4", "gravatar_id": "", "url": "https://api.github.com/users/github-actions%5Bbot%5D", "html_url": "https://github.com/apps/github-actions", "followers_url": "https://api.github.com/users/github-actions%5Bbot%5D/followers", "following_url": "https://api.github.com/users/github-actions%5Bbot%5D/following{/other_user}", "gists_url": "https://api.github.com/users/github-actions%5Bbot%5D/gists{/gist_id}", "starred_url": "https://api.github.com/users/github-actions%5Bbot%5D/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/github-actions%5Bbot%5D/subscriptions", "organizations_url": "https://api.github.com/users/github-actions%5Bbot%5D/orgs", "repos_url": "https://api.github.com/users/github-actions%5Bbot%5D/repos", "events_url": "https://api.github.com/users/github-actions%5Bbot%5D/events{/privacy}", "received_events_url": "https://api.github.com/users/github-actions%5Bbot%5D/received_events", "type": "Bot", "user_view_type": "public", "site_admin": false }, "created_at": "2022-12-21T17:02:06Z", "updated_at": "2022-12-26T11:02:08Z", "author_association": "CONTRIBUTOR", "body": "****CLA Assistant Lite bot**** All contributors have signed the CLA ✍️ ✅", "reactions": { "url": "https://api.github.com/repos/laurent22/joplin/issues/comments/1361674655/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 }, "performed_via_github_app": null }, { "url": "https://api.github.com/repos/laurent22/joplin/issues/comments/1365087509", "html_url": "https://github.com/laurent22/joplin/pull/6469#issuecomment-1365087509", "issue_url": "https://api.github.com/repos/laurent22/joplin/issues/6469", "id": 1365087509, "node_id": "IC_kwDOBLftOs5RXZUV", "user": { "login": "ken1kob", "id": 16041683, "node_id": "MDQ6VXNlcjE2MDQxNjgz", "avatar_url": "https://avatars.githubusercontent.com/u/16041683?v=4", "gravatar_id": "", "url": "https://api.github.com/users/ken1kob", "html_url": "https://github.com/ken1kob", "followers_url": "https://api.github.com/users/ken1kob/followers", "following_url": "https://api.github.com/users/ken1kob/following{/other_user}", "gists_url": "https://api.github.com/users/ken1kob/gists{/gist_id}", "starred_url": "https://api.github.com/users/ken1kob/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/ken1kob/subscriptions", "organizations_url": "https://api.github.com/users/ken1kob/orgs", "repos_url": "https://api.github.com/users/ken1kob/repos", "events_url": "https://api.github.com/users/ken1kob/events{/privacy}", "received_events_url": "https://api.github.com/users/ken1kob/received_events", "type": "User", "user_view_type": "public", "site_admin": false }, "created_at": "2022-12-26T11:01:50Z", "updated_at": "2022-12-26T11:01:50Z", "author_association": "CONTRIBUTOR", "body": "I have read the CLA Document and I hereby sign the CLA", "reactions": { "url": "https://api.github.com/repos/laurent22/joplin/issues/comments/1365087509/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 }, "performed_via_github_app": null }, { "url": "https://api.github.com/repos/laurent22/joplin/issues/comments/1817817440", "html_url": "https://github.com/laurent22/joplin/pull/6469#issuecomment-1817817440", "issue_url": "https://api.github.com/repos/laurent22/joplin/issues/6469", "id": 1817817440, "node_id": "IC_kwDOBLftOs5sWbFg", "user": { "login": "laurent22", "id": 1285584, "node_id": "MDQ6VXNlcjEyODU1ODQ=", "avatar_url": "https://avatars.githubusercontent.com/u/1285584?v=4", "gravatar_id": "", "url": "https://api.github.com/users/laurent22", "html_url": "https://github.com/laurent22", "followers_url": "https://api.github.com/users/laurent22/followers", "following_url": "https://api.github.com/users/laurent22/following{/other_user}", "gists_url": "https://api.github.com/users/laurent22/gists{/gist_id}", "starred_url": "https://api.github.com/users/laurent22/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/laurent22/subscriptions", "organizations_url": "https://api.github.com/users/laurent22/orgs", "repos_url": "https://api.github.com/users/laurent22/repos", "events_url": "https://api.github.com/users/laurent22/events{/privacy}", "received_events_url": "https://api.github.com/users/laurent22/received_events", "type": "User", "user_view_type": "public", "site_admin": false }, "created_at": "2023-11-19T10:49:00Z", "updated_at": "2023-11-19T10:49:00Z", "author_association": "OWNER", "body": "See https://github.com/laurent22/joplin/pull/6446#issuecomment-1817817260", "reactions": { "url": "https://api.github.com/repos/laurent22/joplin/issues/comments/1817817440/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 }, "performed_via_github_app": null } ] }