feat: add runtime book content addition api#360
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a new Runtime Content API for Modonomicon, allowing developers to programmatically add categories, entries, and pages to existing books at runtime. The implementation features a fluent batch API for queuing operations, a manager to handle validation and application of these changes, and updates to the BookDataManager to support partial book rebuilding and network synchronization. Feedback was provided regarding a redundant loop in the RuntimeBookContentManager where entries are manually re-added to a category that should already contain them following the cloning process.
| for (var entry : addCategory.entries()) { | ||
| addCategory.category().addEntry(entry); | ||
| } |
There was a problem hiding this comment.
This loop appears to be redundant. The addCategory.category() object is a clone of the original category, created via serialization and deserialization in cloneCategory. The deserialization process (BookCategory.fromNetwork) should fully reconstruct the category object, including its internal list of entries. Therefore, the category should already contain these entries, and iterating through addCategory.entries() to add them again is unnecessary.
Removing this loop would make the code cleaner and avoid potential side effects if the addEntry method's logic were to change in the future.
No description provided.