Skip to content

Releases: murageh/save-progress

2.0.0

03 Dec 08:27
f8c89c1
Compare
Choose a tag to compare

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

  1. Strict Typing Implementation:

    • Introduced strict typing across various components and hooks to enhance type safety and reduce runtime errors.
    • Updated useFormProgress and AutoSaveFormikForm to use generic types for better type inference and validation.
  2. Custom Hook Enhancements:

    • Refactored useFormProgress to include additional properties such as fetchInitialValues for asynchronous initial value fetching.
    • Improved error handling and logging within the custom hook to provide better debugging information.
  3. Component Refactoring:

    • Refactored AutoSaveFormikForm to ensure compatibility with Formik context and improve the auto-save functionality.
    • Added memoization to AutoSaveFormikForm to prevent unnecessary re-renders and optimize performance.
  4. Deprecation Notices:

    • Marked useProgress and useSaveProgress as deprecated in favor of the new useFormProgress hook.
    • Updated documentation to guide developers towards using the new hook.
  5. Code Cleanup and Optimization:

    • Removed redundant code and improved overall code readability.
    • Ensured consistent coding standards and formatting across the modified files.
  6. Bug Fixes:

    • Fixed issues related to local storage handling and data persistence in useFormProgress.
    • Addressed potential race conditions in the initialization logic of useFormProgress.

Migration Instructions

If you are upgrading from a previous version, please note the following changes:

  1. The useSaveProgress hook has been renamed to useFormProgress. You can still use useSaveProgress and useProgress for backwards compatibility, but it is recommended to switch to useFormProgress.
  2. The AutoSaveForm component has been renamed to AutoSaveFormikForm. You can still use AutoSaveForm for backwards compatibility, but it is recommended to switch to AutoSaveFormikForm.

To migrate, follow these steps:

  1. Replace all instances of useSaveProgress and useProgress with useFormProgress.
  2. Replace all instances of AutoSaveForm with AutoSaveFormikForm.

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 useFormProgress hook.

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

1.0.11

04 Mar 22:33
7f29ba6
Compare
Choose a tag to compare
1.0.11 Pre-release
Pre-release

What's Changed

Full Changelog: 1.0.10...1.0.11

Deprecate `useSaveProgress`

23 Feb 13:07
32c6ad8
Compare
Choose a tag to compare

What's Changed

Full Changelog: 1.0.9...1.0.10

Support Next.js

22 Feb 11:10
539a8ba
Compare
Choose a tag to compare

What's Changed

Full Changelog: v1.0.8...1.0.9

v1.0.8

06 Feb 18:10
e8c0526
Compare
Choose a tag to compare

Adds support for a third storage prop. This can either be localStorage or sessionStorage, It defaults to localStorage.

See details about this version

What's Changed

Full Changelog: v1.07...v1.0.8

v1.0.6

05 Feb 06:39
6532cd1
Compare
Choose a tag to compare
1.0.6

v1.0.5

04 Feb 22:44
7e90bff
Compare
Choose a tag to compare

Both React and Formik errors have been fixed.

What's Changed

Full Changelog: v1.0.4...v1.0.5

v1.0.4

04 Feb 21:40
7dd44a1
Compare
Choose a tag to compare
1.0.3