Skip to content

Glasgow | 26-ITP-May | Sandani Kannangara | Sprint 2 | Fix library debugging - #524

Open
SandzSoft wants to merge 7 commits into
CodeYourFuture:mainfrom
SandzSoft:fix-library-debugging
Open

Glasgow | 26-ITP-May | Sandani Kannangara | Sprint 2 | Fix library debugging#524
SandzSoft wants to merge 7 commits into
CodeYourFuture:mainfrom
SandzSoft:fix-library-debugging

Conversation

@SandzSoft

Copy link
Copy Markdown

Self checklist

  • I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • My changes meet the requirements of the task
  • I have tested my changes
  • My changes follow the style guide

Changelist

  • Fixed books not rendering on page load.
  • Fixed errors when adding new books.
  • Fixed author field using title value.
  • Fixed delete button functionality.
  • Fixed read status handling.
  • Added validation for required fields.
  • Added form reset after adding books.
  • Refactored DOM handling to use tbody.
  • Improved variable naming and readability.

@SandzSoft SandzSoft added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Aug 7, 2026

@cjyuan cjyuan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you check if any of this general feedback can help you further improve your code?
https://github.com/CodeYourFuture/Module-Data-Flows/blob/general-review-feedback/debugging/book-library/feedback.md

Doing so can help me speed up the review process. Thanks.

@cjyuan cjyuan added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Aug 7, 2026
@SandzSoft SandzSoft added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. and removed Reviewed Volunteer to add when completing a review with trainee action still to take. labels Aug 8, 2026

@cjyuan cjyuan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to https://validator.w3.org/, there are errors in your index.html. Could you fix these errors?

@@ -1,103 +1,109 @@
let myLibrary = [];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we declare myLibrary in a way that prevents it from being accidentally reassigned?

Comment on lines +23 to +27
const titleInput = document.getElementById("title");
const authorInput = document.getElementById("author");
const pagesInput = document.getElementById("pages");
const isReadInput = document.getElementById("isRead");
const bookForm = document.getElementById("book-form");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Common practice is to declare all variables before function definitions.

Comment on lines +29 to +32
bookForm.addEventListener("submit", function (event) {
event.preventDefault();
addBook();
});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not place all "code that runs once on page load" in one place. For example, inside the on page load callback function.

Comment on lines +53 to +56
titleInput.value = "";
authorInput.value = "";
pagesInput.value = "";
isReadInput.checked = false;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could also use the form's built-in .reset() method to reset the form.

myLibrary.splice(i, 1);
render();

alert(`You've deleted title: ${deletedTitle}`);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alert() is a blocking function call. As a result, invoking it prevents the browser from updating the UI until the dialog is dismissed.

If time permits, research for approaches that allows the UI to update before displaying the alert dialog. (This is an optional change).

@cjyuan cjyuan added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Aug 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Reviewed Volunteer to add when completing a review with trainee action still to take.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants