Repository navigation
feat(useCallbackOnce): rename useCallbackOncePerRender to useCallbackOnce - #545
Conversation
🦋 Changeset detectedLatest commit: d1b0681 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
|
Size Change: +589 B (+0.51%) Total Size: 115 kB 📦 View Changed
ℹ️ View Unchanged
|
mnxmnz
left a comment
There was a problem hiding this comment.
Thanks for this, the deprecation flow turned out really nice!
One small suggestion, not a blocker. On the docs site, useCallbackOncePerRender shows up right next to useCallbackOnce in the reference page and sidebar, with nothing saying it's deprecated. Maybe generateReferenceIndex could add a (deprecated) label using extractDeprecation? Totally fine as a follow-up too.
Render a JSDoc @deprecated tag as a warning block at the top of the generated page, move deprecated exports into a separate Deprecated table in the generated skill, and replace the blanket @deprecated ban in verifySkill with checks that the table matches the deprecated exports and that the Common needs table names none of them.
…Once useCallbackOncePerRender runs the callback once until deps change, not once per render. Add useCallbackOnce with the same signature and behavior, and keep useCallbackOncePerRender as a deprecated alias of it. The JSDoc now describes the actual behavior, types the callback and the returned function from F, and lists userId in the second example's dependencies because the returned function keeps the same reference.
…ted alias A deprecated alias no longer has a documentation page. useCallbackOncePerRender moves into the useCallbackOnce folder as a one-line alias, its pages are removed, and the useCallbackOnce page says it was renamed. The docs and skill tooling now expects a deprecated export to have no page, lists it in the skill's Deprecated table without a link, and the old URL redirects to the new page.
637fa38 to
d1b0681
Compare
|
@mnxmnz Thanks! I went one step further and removed the old-name page entirely, so nothing deprecated shows up in the sidebar or the reference page anymore. The |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## v1-base #545 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 69 70 +1
Lines 2280 2282 +2
Branches 735 735
=========================================
+ Hits 2280 2282 +2 🚀 New features to boost your workflow:
|
Overview
Closes #542
useCallbackOnce. It has the same signature and behavior asuseCallbackOncePerRender, whose name suggests the callback runs once per render when it actually runs once untildepschange.useCallbackOncePerRenderis now a deprecated alias ofuseCallbackOnce. It is the same function, so existing calls keep working, and editors show it as deprecated.depschange, typescallbackasFbecause it also receives the returned function's arguments, and addsuserIdto the second example's dependency list.depsdescription no longer reads as if a change runs the callback; a change lets the returned function run it once more. The return value is documented as(...args: Parameters<F>) => voidwith a reference that never changes, which is why the example needsuserIdin its dependency list. The Spanish pages drop the mistranslation "memorizada" along the way.@deprecatedtag:docs:genrenders the@deprecatedtext as a warning block at the top of the page.test:skillchecks that the Deprecated table matches the@deprecatedexports and that the Common needs table names none of them. A@deprecatedtag must name its replacement in backticks.Tests
The tests moved to
useCallbackOnce.test.tsunchanged. One added test checks thatuseCallbackOncePerRenderis the same function, which also keeps the alias file covered. The tooling changes are covered in the.scriptsspecs.Checklist
yarn run fixto format and lint the code and docs? (yarn testpasses)yarn run test:coverageto make sure there is no uncovered line?