London | 26-ITP-May | Mandip Sanger | Sprint 2 | Book Library - #569
London | 26-ITP-May | Mandip Sanger | Sprint 2 | Book Library#569mandipsanger wants to merge 8 commits into
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
cjyuan
left a comment
There was a problem hiding this comment.
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.
|
My Program is working now but failing checks Validate PR Metadata workflow run. |
|
its showing Validate PR Metadata thread 'main' (2352) panicked at src/bin/pr-metadata-validator.rs:74:6: |
| <label for="pages">Pages:</label> | ||
| <input | ||
| type="number" | ||
| class="form-control" | ||
| id="pages" | ||
| name="pages" | ||
| min="1" | ||
| step="1" | ||
| required | ||
| /> |
There was a problem hiding this comment.
The browser checks the input elements against the specified constraints only when a user submits a form.
Without <form>, the browser won't enforce the constraints like required or min="1".
There was a problem hiding this comment.
please check some changes i have made
| <label class="form-check-label"> | ||
| <input | ||
| type="checkbox" | ||
| class="form-check-input" | ||
| id="check" | ||
| value="" | ||
| />Read | ||
| /> | ||
| Read | ||
| </label> |
There was a problem hiding this comment.
This checkbox is not showing.
The issue is related to Bootstrap 4.4.1. Could you use AI to find a way to fix the issue? Mentioning "Bootstrap 4.4.1" might help.
| type="submit" | ||
| value="Submit" | ||
| class="btn btn-primary" | ||
| onclick="submit();" |
There was a problem hiding this comment.
Could you lookup the trade off between
- Assigning event listener in HTML
- Assigning event listener in JS via
.addEventListener()
| @@ -1,46 +1,64 @@ | |||
| let myLibrary = []; | |||
There was a problem hiding this comment.
Could we declare myLibrary in a way that prevents it from being accidentally reassigned?
| title.value, | ||
| author.value, | ||
| pages.value, |
There was a problem hiding this comment.
These are raw input.
What if title.value is " Some title " or " "? What if pages.value is "00030" or "3e1"? These values could pass the checks on lines 30 and 38.
| const title = document.getElementById("title"); | ||
| const author = document.getElementById("author"); | ||
| const pages = document.getElementById("pages"); | ||
| const check = document.getElementById("check"); |
There was a problem hiding this comment.
Could you name these variables to emphasise that they are input elements?
| title.value = ""; | ||
| author.value = ""; | ||
| pages.value = ""; | ||
| check.checked = false; |
There was a problem hiding this comment.
If these input elements are in a form, we could just call a form's method to reset all elements.
| for (let n = rowsNumber - 1; n > 0; n--) { | ||
| table.deleteRow(n); | ||
| } |
There was a problem hiding this comment.
Could you look up a more efficient approach (than deleting table rows one by one) to clear the <tbody> part of a table?
| alert(`You've deleted title: ${myLibrary[i].title}`); | ||
|
|
||
| myLibrary.splice(i, 1); | ||
| render(); |
There was a problem hiding this comment.
The alert message is shown before the book is actually deleted; the deletion only occurs after the alert dialog is dismissed. This introduces a risk that the operation may not complete (e.g., if the user closes the browser before dismissing the alert).
In general, it’s better to display a confirmation message only after the associated operation has successfully completed.
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).
Self cheklist
Sprint 2 Data flows book library