- #98: Return type of
submit()function is changed fromvoidtoPromise<void>@BeckyPollard - #95:
loadingdid not go back totrueif an error occurred in some cases.
- #94: Complete rewrite of
useInfiniteCollectionit had still more issues in edge-cases, so it needed a higher-approach to fixing it.
Note: a bunch of versions were skipped. They were all released as beta to test issues with this hook.
- #93: Reverted fix from for
useInfiniteCollection, which had another negative side-effect. Both the side-effect and the original issue should be fixed with this release.
- #90
useInfiniteCollectiondid not refresh correctly with if there was only 1 page.
- #87
useInfiniteCollection'srefreshOnStaledid not function correctly. it now fully resets the component.
- Same as the last beta.
useNewResourcenow assumes HAL as the default format.
- Added
<SelectLink>component. This component renders a<select>element with a list of links from a resource. - Added
useNewResource, which lets you create new resources on collections using aPOSTrequest. - Several optimizations, reducing renders for
useResourcefrom 5 down to 2 in certain cases. react-kettingnow re-exports everything from thekettingpackage.- BC Break:
modeoption fromuseResourcehas been removed. - Fixed an infinite rendering bug when passing a promise to
useResource.
- Fix Ketting dependency version.
- #75:
usePagedCollectionis renamed touseInfiniteCollection. The old function name will continue to work until the next major version, but you are encouraged to rename all uses of it. - #76 #61:
useCollection()now returns the sameitemsarray every call. This can help avoid re-renders and potentially even render loops.
useCollectionnow returns 'resourceState' and 'resource', which makes it less likely that someone needs bothuseResourceanduseCollectionin the same component. These objects were already readily available, so might as well return them.
- BC Break: The signature of
useResourcehas changed, but only if you were passing options. If you calleduseResource(options)before, it must now be structured asuseResource(resource, options)to be consistent with every other hook. - In some cases when a React component passes a new resource as a string to useResource, the useResource might return "undefined" for the resource, which can result in a white screen of death. This one was a bit of a doozy, check the PR for more information: #67
- Remove an unneeded initial render in
useCollection.
- In some cases when a React component passes a new resource as a string to useResource, the useResource might return "undefined" for the resource, which can result in a white screen of death. See PR #67 #70
- In some scenarios
RequireLogincould crash due to a function sometimes being called before it's defined (@mihok). - Works with Typescript 4.4 strict.
usePagedCollectiondid not behave correctly with pages or collections that were already cached. Now it doesn't care if the page was cached or not.
- In
usePagedCollection, when the resource property changes, the first pag was not reloaded, resulting in an empty collection.
- If
usePagedCollectionwas given a promise, it would go in an infinite render loop.
- Added
usePagedCollection, which allows users to create 'infinite scroll' interfaces. - Some heavy duty refactoring to encourage better re-use of internal hooks.
- Stable release
- No functional changes since 2.0.0-beta.0
- Compatibility with Ketting 7.
UseResourceOptionsis now exported
- #43: Remove incorrect 'browser' property from
package.json. This should never have been there and was causing issues for some build systems.
- Correctly handle 'invalid_grant' errors from an OAuth2 server.
useResolveResourceis now exported.
- Add
refreshOnStaleoption touseResource.
- The 'type' of the result of useCollection is not dependent on the 'type'
of the collection that was passed it. This was a bug in
useCollection.
- Update ketting and fetch-mw-oauth2
- expireAt for oauth2 token is now preserved via LocalStorage.
- Add 'refreshOnStale' option to
useCollection, to automatically fetch new items if the collection is known to have changed.
- Refresh "items" in
useCollectionif the resource argument changed.
- Cleanup bug in
useResourcehook.
- Fixing another bug related to prop changes / effects / dependencies in useEffect.
- Make sure
dataandresourceStateget re-fetched when the resource arg changes in theuseResourcehook.
- Guarantee re-render on when
setData()orsetResourceState()is used.
- Fix an issue with RequireLogin trying to validate a 'code' twice.
- RequireLogin should be a bi snappier with fewer async ops.
- Fewer renders and much faster first render if there's a cached state with
useResource. - Handle expired Access / Refresh tokens better. We now send the user back into the authentication process.
- Added the ability to override the endpoint
RequireLoginuses to test if the Bearer token is correct.
- Added a
useCollectionhook, for easily traversing a collection of resources. - The
useResourcehook now also emits the 'real' resource that was used.
- Added a
RequireLogincomponent. If you're using the OAuth2authorization_codeflow, this component can do most of the work to set this up, and set the correct access/refresh tokens in Ketting. It uses LocalStorage to save the tokens. (@simistern) - Fix a bug related to
useResourceandsetData.
- Ketting 6 got a stable release, so this package gets a 1.0 release as well.
useResourcecan now take a Promise that resolves to a resource from its first argument.ResourceLikeis now exported.
useResource()can now take a URI argument instead of a Resource object.useResource()can also take a Promise that resolves to a resource.- Added a
KettingProvidercomponent, giving any component access to the closest Ketting client viauseContext/contextType. - Added a
useClienthook to easily find the Client object in functional components.
- Rewrite of
useResource. It can now fully manage updating state, submitting to the server. - 'New resource' flow in useResource, allowing it be be used to create a new
resource via
POSTrequest, and subsequentPUTrequests. - A simpler
useReadResourcehook. Providing read-only access to resources, and change subscriptions.
useResourcenow also returnsupdateResourceStateandupdateDatafunctions, to easily store state changes in a local cache.useResourcehook will avoid emitting state changes after a component is cleaned up.
kettingis now a peerDepedency.- Updated dependencies.
- Updated to latest Ketting 6 alpha.
- Both the hook and HoC listen for the
updateevent and automatically re-render when they are triggered. - The
stateproperty in the useResource hook is renamed toresourceStatefor consistency with the HoC. - All
bodyproperties are renamed todata.
- Added a
withResourceHoC for class-based React Components.
- Remove race condition.
- Remove webpack. Lets assume for now people have their own build pipeline.
- Simplify result from
useResource.
- useResource now returns an object with
loading,error,bodyandstateproperties.
- First version!