fix(english/mvlempyr): return contract-conformant novel items - #2508
Merged
rajarsheechatterjee merged 1 commit intoSep 8, 2026
Merged
rajarsheechatterjee merged 1 commit into
rajarsheechatterjee merged 1 commit into
Conversation
popularNovels and searchNovels returned the raw cached objects from
getAllNovels(), leaking the internal ExtraNovelData fields. That put
genres on a NovelItem as a string[], while the contract types it as a
comma-separated string on SourceNovel only.
Older app versions called genres.split() unguarded when rendering a
novel opened from browse, so the array crashed the novel screen with
"undefined is not a function". Map both return sites down to
{name, path, cover}; filtering and sorting still run on the full
objects beforehand.
Refs lnreader#2437
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Problem
Opening any MVLEMPYR novel from browse or search crashes the novel screen on LNReader v2.1.0 (the current
Latestrelease) with:Refs #2437 (same versions: app 2.1.0, plugin 1.0.12).
Root cause
popularNovelsandsearchNovelsreturn the raw cached objects fromgetAllNovels()straight throughpaginate(), so the internalExtraNovelDatafields ride along on what is typed as aPlugin.NovelItem:{ "name": "...", "path": "...", "cover": "...", "genres": ["Horror", "Mature"], "tags": [...], "avgReview": 5, "created": 1745549652956 }NovelItemis{name, path, cover?}, andgenresis only valid onSourceNovel, where it is documented as a comma-separated string.parseNovelreturns it correctly as a string; the browse/search list did not.Before app v2.1.2,
NovelGenrescalledgenres.split(/,\s*/)inside auseMemowithout validating the type. A novel opened from browse renders that header from the list item — with the array — beforeparseNovelresolves.Array.prototype.splitdoes not exist, so calling it throwsundefined is not a function, which matches the reported stack exactly.App-side this was guarded in LNReader
eb12bdf("Prevent Novel Genre Rendering Crashes", shipped in v2.1.2), but v2.1.2 and v2.1.3 are both pre-releases — everyone on stable v2.1.0 still hits it. Plugins update independently of the app, so fixing it here reaches those users without an app update.Fix
Map both return sites down to
{name, path, cover}. Filtering and sorting still run on the full objects beforehand, andgetAllNovels()'s cache is untouched, so the filter/order behaviour is unchanged.Version bumped
1.0.12→1.0.13(patch — compatibility fix).Verification
npm run check:plugin -- plugins/english/mvlempyr.ts→ 4/4 PASS (popularNovels20 novels,searchNovels6 results,parseNovel1432 chapters,parseChapter9044 chars)npx eslintclean,npx tsc --noEmit --project tsconfig.production.jsoncleanpopularNovelsandsearchNovelsnow return exactly{cover, name, path}, and thatparseNovel().genresis still a string ("Horror,Mature,Mystery,Psychological,Supernatural")Checklist
type(scope): descriptionNote
Per
AGENTS.md, disclosing that this change was prepared with AI assistance so reviewers can weight their review accordingly.