Fix misc bugs and TS issues#84
Open
kolyasya wants to merge 6 commits into
Open
Conversation
… context structuredClone is used in MinimongoInjector but was not typed. Adding lib: [esnext, dom] to tsconfig covers the extension bundle; the ambient declaration in index.d.ts covers the injected page script where tsconfig libs do not apply. Made-with: Cursor
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.
While working on iframe support and SubsManager compatibility (coming in a separate PR), I needed the extension to actually run cleanly first. These are the bugs I hit along the way.
Fixes
StringUtils.truncatereturned a character array instead of a string[...str.slice(0, max), '...']spreads the string into individual characters. In template literals this rendered asH,e,l,l,o,.... Fixed tostr.slice(0, max) + '...'.Navigation links opened broken URLs
Same spread bug —
openTab([...url, '/issues'])passed an array of characters tobrowser.tabs.create, so the Issues and Star links silently did nothing. Fixed to string concatenation.Minimongo tab crashed with
Cannot read properties of null (reading '_id')cleanup()inMinimongoInjectorusedreturninside afor...ofloop wherecontinuewas needed. On any falsy field value (null,0,false,""), the function exited early and returnedundefinedfor an otherwise valid document. Thoseundefinedvalues reached the React virtualised list renderer, which then crashed trying to read._idon null. Fixed at three layers:return→continuein the loop,.filter(Boolean)aftercleanup(), and a null guard in the row renderer as a safety net.FilterConstantsTypeScript type inference errorObject.fromEntries(flatMap(...))return type wasn't inferred correctly, causing a downstream TS error. Added explicit cast.Content.tsmessage source check consistencyMinor fix in the content script message handler.
structuredClonenot typed (MinimongoInjector)MinimongoInjectorcallsstructuredClone, which is available at runtime but untyped in the configured TS libs. Added"lib": ["esnext", "dom"]totsconfig.jsonfor the extension bundle; added an ambient declaration inindex.d.tsfor the injected page-context script where tsconfig libs don't apply.