fix(issues): Use map for project member index#116996
Conversation
Project slugs can collide with Object prototype keys like `constructor`, which made the assignee selector receive a non-array member list in issue rows. Use a Map for the project member index so slug lookups are data lookups instead of object property access. Adds coverage for the issue-list path that was crashing. Co-authored-by: Codex GPT-5 <noreply@openai.com>
Keep memberList required at issue-list component boundaries while still allowing the query result to be undefined during loading or from drawer-only entry points. Co-authored-by: Codex GPT-5 <noreply@openai.com>
| const projectMembers = result.get(project) ?? []; | ||
| projectMembers.push(member.user); | ||
| result.set(project, projectMembers); |
There was a problem hiding this comment.
still fresh, but maybe it's time? https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/getOrInsert
There was a problem hiding this comment.
i tried but it doesn't work in jest yet, will need to figure out whats happening there
There was a problem hiding this comment.
in prod i do see the pollyfill already
There was a problem hiding this comment.
cool. no need to rush this little thing
| drawerKey: 'supergroup-drawer', | ||
| }); | ||
| openDrawer( | ||
| () => <SupergroupDetailDrawer memberList={undefined} supergroup={supergroup} />, |
There was a problem hiding this comment.
i think memberList can just be omitted here since it's optional for SupergroupDetailDrawer, right?
There was a problem hiding this comment.
or should that one be updated to be required alongside the SupergroupIssueList props?
There was a problem hiding this comment.
i'll just try to not touch super group drawer for now, going to delete soon
Follow-up from #116996 prevents a page crash when typing `constructor:`
Follow-up from #116996 Filtering on 'constructor' would collide with object properties
Project slugs can collide with Object prototype keys like
constructor, which made the assignee selector receive a non-array member list in issue rows.Use a Map for the project member index so slug lookups are data lookups instead of object property access. Adds coverage for the issue-list path that was crashing.
could use
Object.create(null)but switching entirely to a map avoids the problem a little better for the future.fixes JAVASCRIPT-39FS