Repository navigation
Release Notes: Version 2.0.0
We are excited to announce the release of version 2.0.0 of @crispice/save-progress. This major release includes significant improvements, new features, and important changes to enhance the functionality and usability of the library.
Major Changes and Enhancements
-
Strict Typing Implementation:
- Introduced strict typing across various components and hooks to enhance type safety and reduce runtime errors.
- Updated
useFormProgressandAutoSaveFormikFormto use generic types for better type inference and validation.
-
Custom Hook Enhancements:
- Refactored
useFormProgressto include additional properties such asfetchInitialValuesfor asynchronous initial value fetching. - Improved error handling and logging within the custom hook to provide better debugging information.
- Refactored
-
Component Refactoring:
- Refactored
AutoSaveFormikFormto ensure compatibility with Formik context and improve the auto-save functionality. - Added memoization to
AutoSaveFormikFormto prevent unnecessary re-renders and optimize performance.
- Refactored
-
Deprecation Notices:
- Marked
useProgressanduseSaveProgressas deprecated in favor of the newuseFormProgresshook. - Updated documentation to guide developers towards using the new hook.
- Marked
-
Code Cleanup and Optimization:
- Removed redundant code and improved overall code readability.
- Ensured consistent coding standards and formatting across the modified files.
-
Bug Fixes:
- Fixed issues related to local storage handling and data persistence in
useFormProgress. - Addressed potential race conditions in the initialization logic of
useFormProgress.
- Fixed issues related to local storage handling and data persistence in
Migration Instructions
If you are upgrading from a previous version, please note the following changes:
- The
useSaveProgresshook has been renamed touseFormProgress. You can still useuseSaveProgressanduseProgressfor backwards compatibility, but it is recommended to switch touseFormProgress. - The
AutoSaveFormcomponent has been renamed toAutoSaveFormikForm. You can still useAutoSaveFormfor backwards compatibility, but it is recommended to switch toAutoSaveFormikForm.
To migrate, follow these steps:
- Replace all instances of
useSaveProgressanduseProgresswithuseFormProgress. - Replace all instances of
AutoSaveFormwithAutoSaveFormikForm.
Example migration:
Before:
import {useSaveProgress} from "@crispice/save-progress";
import {AutoSaveForm} from "@crispice/save-progress";
const MyFormComponent = () => {
const [values, updateValues, deleteValues] = useSaveProgress({key: 'user-form'});
return (
// ... formik wrapper
<AutoSaveForm saveFunction = {updateValues} />
// ... rest of the form
);
}After:
import {useFormProgress} from "@crispice/save-progress";
import {AutoSaveFormikForm} from "@crispice/save-progress";
const MyFormComponent = () => {
// const [values, updateValues, deleteValues] = useFormProgress({dataKey: 'user-form'}); // No need to have this line anymore
return (
<AutoSaveFormikForm dataKey="user-form"> // No need to pass the saveFunction prop. You could provide the `initialValues` prop but I don't see why you would need to.
{/* form elements */}
< /AutoSaveFormikForm>
);
}Additional Notes
- This release aims to improve the maintainability and robustness of the codebase by leveraging TypeScript's strict typing features.
- Developers are encouraged to review the updated documentation and migrate to the new
useFormProgresshook.
We hope you enjoy the new features and improvements in this release. Thank you for using @crispice/save-progress!
Full Changelog: 1.0.11...2.0.0