feat: improve UX handling when multiple main files detected#1700
Open
nilayarya wants to merge 2 commits intoelectron:mainfrom
Open
feat: improve UX handling when multiple main files detected#1700nilayarya wants to merge 2 commits intoelectron:mainfrom
nilayarya wants to merge 2 commits intoelectron:mainfrom
Conversation
BlackHole1
requested changes
Jul 23, 2025
Member
BlackHole1
left a comment
There was a problem hiding this comment.
Hi @nilayarya, thank you for your PR, but it seems to be incomplete. From the current PR, I can only temporarily consider this as an improvement for the edge case when there are multiple mainEntryPoints in the gist. When I create another mainEntryPoint from the left sidebar, it throws an error. According to the description in #1508, I believe @dsanders11 is hoping for a complete mainEntryPoint switching mechanism.
fiddle/src/renderer/editor-mosaic.ts
Lines 284 to 290 in 3838dd5
Comment on lines
+358
to
+365
| if (!this.mainEntryPoint || !this.files.get(this.mainEntryPoint)) { | ||
| const entryPoint = Array.from(this.files.keys()).find((id) => | ||
| isMainEntryPoint(id), | ||
| ); | ||
| if (entryPoint) this.mainEntryPoint = entryPoint; | ||
| return entryPoint; | ||
| } | ||
| return this.mainEntryPoint; |
Member
There was a problem hiding this comment.
Suggested change
| if (!this.mainEntryPoint || !this.files.get(this.mainEntryPoint)) { | |
| const entryPoint = Array.from(this.files.keys()).find((id) => | |
| isMainEntryPoint(id), | |
| ); | |
| if (entryPoint) this.mainEntryPoint = entryPoint; | |
| return entryPoint; | |
| } | |
| return this.mainEntryPoint; | |
| public mainEntryPointFile(): EditorId | null { | |
| if (this.mainEntryPoint && this.files.get(this.mainEntryPoint)) { | |
| return this.mainEntryPoint; | |
| } | |
| for (const [id] of this.files) { | |
| if (isMainEntryPoint(id)) { | |
| this.mainEntryPoint = id; | |
| break; | |
| } | |
| } | |
| return this.mainEntryPoint; |
Make the code more intuitive and optimize performance a bit.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of Change
Suggests UI changes to resolve #1508
Some gifs:
gist-url: https://gist.github.com/nilayarya/dfac02c9af5c699f3efc146ddf946f9f
CC @dsanders11
Checklist
yarn testpasses