Closed ttizze closed 2 weeks ago
Hey @ttizze, here are examples of how you can ask me to improve this pull request:
@sweep Fix the CI errors.
@sweep Add unit tests for the `handleAutoSave` function in EditPage component to verify:
- Form data is correctly constructed with all fields
- The function doesn't submit when fetcher is already submitting
- The debounce behavior works as expected
:book: For more information on how to use Sweep, please read our documentation.
The pull request introduces significant enhancements to the EditPage
component by implementing an auto-save feature for form data. This is facilitated by new functions to handle content changes and manage unsaved states. The Editor
component's interface is modified to shift the responsibility of tracking unsaved changes to the parent component. Additionally, updates are made to the mutations.server.ts
file to ensure data integrity by removing outdated entries during tag and source text updates. Dependency versions in package.json
are also updated without altering the existing functionality.
File | Change Summary |
---|---|
web/app/routes/$userName+/page+/$slug+/edit/_edit.tsx | - Added handleAutoSave and handleContentChange functions. |
- Introduced debouncedAutoSave variable. |
|
- Updated rendering logic to use handleContentChange . |
|
web/app/routes/$userName+/page+/$slug+/edit/components/editor/Editor.tsx | - Updated EditorProps interface: replaced setHasUnsavedChanges with onContentChange . |
- Modified onUpdate callback in useEditor hook to use onContentChange() . |
|
web/app/routes/$userName+/page+/$slug+/edit/functions/mutations.server.ts | - Enhanced createOrUpdateSourceTexts and upsertTags functions to delete outdated entries. |
web/package.json | - Updated multiple dependency versions. |
web/app/routes/$userName+/page+/$slug+/components/sourceTextAndTranslationSection/TranslationSection.tsx | - Added CSS class text-gray-700 dark:text-gray-200 to <span> for improved text styling. |
web/tailwind.config.ts | - Updated color definitions for "blue-gray" palette from hex to HSL values. |
EditPage
component in _edit.tsx
regarding the handling of tags are related to the modifications in the upsertTags
function in mutations.server.ts
, which simplifies the input structure for tags.formId
prop from the EditPage
component in _edit.tsx
suggests a simplification that aligns with the overall refactoring of the component's interface, which is also reflected in the changes made to the EditHeader
component.EditPage
component in _edit.tsx
, including error handling and validation logic, are relevant to the changes made in the EditHeader
component, which also sees structural modifications to enhance the user interface.🐰 In the meadow where bunnies play,
Auto-save has come to stay!
With each change, our work's in sync,
No more worries, just pause and think.
Hopping through edits, oh what a delight,
Our pages save, all day and night! 🌼
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Summary by CodeRabbit
New Features
onContentChange
prop.Bug Fixes
Chores