Fix: Resolve bugs in KnowledgeCard component
Created by: Edouard-Legoupil
This commit addresses two critical bugs in the KnowledgeCard component:
-
Stale State on Populate: When a user edited an existing knowledge card and clicked "Popover Card Content," the system was using stale data from memory instead of the updated values on the page. This was due to a stale closure in the
handleSavefunction. The fix introducesuseRefhooks for the form fields, ensuring thathandleSavealways has access to the latest state. -
Edits Not Saving to JSON: When a user edited the sections of a knowledge card, the changes were not being persisted to the corresponding JSON file in the backend. This was because the
update_knowledge_cardfunction was missing the logic to save the file. The fix adds a call to_save_knowledge_card_content_to_filein the update endpoint, ensuring that all changes are saved correctly.
- Does my code meet the quality standards for releasing packages?
- Does the reviewer have all the information to validate the features/issues without too much research?
- Does the customer who will validate the associated tickets have the information to do so without wasting time?
Issues to validate to close :
-
issue #
Processed issues to keep open or in progress:
-
issue #
Checklist:
-
Does the package check go local? -
Does the CI pass? -
Are the added / fixed features documented, tested? -
Are the added features / solved problems briefly presented in the PR message? -
Are the changes related to tickets / issues that I have listed in the commits and in the PR itself? -
Are the tickets in "review" mode in the Project Tracking Board? -
Does each ticket, if it is to be closed after acceptance of the PR, contain a comment that tells how to validate it?