Skip to content

Fix: Resolve bugs and initialization error in KnowledgeCard

Edouard Legoupil requested to merge fix/knowledge-card-bugs into main_dev

Created by: Edouard-Legoupil

This commit addresses two critical bugs in the KnowledgeCard component and a subsequent initialization error.

  1. Stale State on Populate: When a user edited an existing knowledge card and clicked "Populate 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 handleSave function. The fix introduces useRef hooks for the form fields, ensuring that handleSave always has access to the latest state.

  2. 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_card function was missing the logic to save the file. The fix adds a call to _save_knowledge_card_content_to_file in the update endpoint, ensuring that all changes are saved correctly.

  3. Initialization Error: Resolved a ReferenceError that occurred in the production build. This was likely caused by a circular dependency. The fix implements lazy loading for all screen components in App.jsx to break the dependency cycle.

  • 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?

Merge request reports

Loading