YPE-1156: Hooks - Deprecate Unused Hooks#187
Conversation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add @deprecated JSDoc directing users to useVersion, useBook, useChapter - Remove useInitData.test.tsx (no tests for deprecated code) - Exclude useInitData.ts from coverage reporting Amp-Thread-ID: https://ampcode.com/threads/T-019cba0e-451d-74d4-9208-f6958c558b50 Co-authored-by: Amp <amp@ampcode.com>
Deprecate dead code not used by the UI package or any known consumers: - useChapterNavigation (UI uses getAdjacentChapter from core directly) - ReaderProvider, ReaderContext, useReaderContext (UI has its own BibleReaderContext) - VerseSelectionProvider, VerseSelectionContext, useVerseSelection (UI handles selection via props) Remove tests for deprecated code and exclude from coverage. Amp-Thread-ID: https://ampcode.com/threads/T-019cba0e-451d-74d4-9208-f6958c558b50 Co-authored-by: Amp <amp@ampcode.com>
🦋 Changeset detectedLatest commit: e14348d The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
Greptile SummaryThis PR deprecates seven unused hooks and providers ( Key changes:
Confidence Score: 4/5
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
subgraph DEPRECATED["Deprecated (this PR)"]
RP["ReaderProvider\n@deprecated"]
RC["ReaderContext / useReaderContext\n@deprecated"]
CN["useChapterNavigation\n@deprecated"]
VSP["VerseSelectionProvider\n@deprecated"]
VSC["VerseSelectionContext\n@deprecated"]
UVS["useVerseSelection\n@deprecated"]
UID["useInitData\n@deprecated"]
end
subgraph ACTIVE["Active (no change)"]
YVP["YouVersionProvider"]
AUTH["YouVersionAuthProvider"]
HOOKS["useBook / useChapter / useVersion\nuseVOTD / usePassage / etc."]
end
subgraph CONSUMERS["Recommended replacements"]
BRC["UI package: BibleReaderContext\n(own implementation)"]
GAC["getAdjacentChapter\n(platform-core)"]
IH["useVersion + useBook + useChapter\n(individual hooks)"]
PROPS["UI package: props / callbacks\n(verse selection)"]
end
CN --> GAC
RP --> BRC
RC --> BRC
UID --> IH
UVS --> PROPS
VSP --> PROPS
VSC --> PROPS
Last reviewed commit: e14348d |
Additional Comments (2)
Two consecutive Merge both blocks into a single JSDoc comment so consumers see both the description and the deprecation notice:
|
The ReaderContext, ReaderProvider, VerseSelectionContext, and VerseSelectionProvider, along with their associated hooks, are deprecated and no longer necessary. These components have been removed to simplify the hooks package.
- Merge duplicate JSDoc blocks on useChapterNavigation into one - Add @deprecated to VerseSelectionContextData type for consistency Amp-Thread-ID: https://ampcode.com/threads/T-019cba40-e17d-779a-aef7-d1a5ea3fd36b Co-authored-by: Amp <amp@ampcode.com>
|
@greptile, please re-review this based on the newest changes. |
Additional Comments (2)
Only
Two separate JSDoc blocks are attached to Merge the |
This ensures that any changes within the .changeset directory are also subject to the unified versioning rule, maintaining consistency across all packages.
|
@greptile, please re-re-review this pull request |
Additional Comments (1)
All other deprecated exports in this PR use the phrase Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time! |
|
@greptile, I've made the change you've mentioned. Please re-re-re-review |
Additional Comments (1)
Consumers watching the Since the unified versioning rule requires all packages to move together, the bump itself is correct — but consider adding a brief note clarifying that Context Used: Rule from |
|
@mic-mart if you do so dare to embark upon this quest, please continue reading... When writing tests for the hooks package, I stumbled upon code inherited from the hackathon that we hadn't used and have no intention or plans to use. Because of that, instead of writing tests unnecessarily for some hooks (even though I've written lots of tests for the hooks package), I found it better to deprecate those unnecessary hooks. Michael, I find you to be a good person to review this code just in case there's some high-level thing that I may be overlooking or if there's some decisions or context that I don't have |
Deprecates hooks and providers that are not used by the UI package or any known consumers. These were inherited from a hackathon project and never adopted.
Deprecated:
useInitData— convenience wrapper overuseVersion,useBook,useChapterthat loses error granularity, dropsrefetch, and has zero consumers. Use the three hooks directly.useChapterNavigation— coupled toReaderProviderwhich nobody uses. The UI package callsgetAdjacentChapterfrom core directly.ReaderProvider,ReaderContext,useReaderContext— the UI package built its ownBibleReaderContextinstead. Zero consumers.VerseSelectionProvider,VerseSelectionContext,useVerseSelection— the UI package handles verse selection via props/callbacks. Zero consumers. (Highlights work won't need this)Tests for all deprecated code have been removed. Deprecated files are excluded from coverage.
This focus to deprecate code came from working on https://lifechurch.atlassian.net/browse/YPE-1156, but... it's important to know that I do have a deprecation ticket at https://lifechurch.atlassian.net/browse/YPE-1140