Repository navigation
Fix monthly revenue totals, tenant cache isolation, and floating points precision errork - #235
Open
AbdulhadeAhmad wants to merge 4 commits into
Open
AbdulhadeAhmad wants to merge 4 commits into
AbdulhadeAhmad wants to merge 4 commits into
Conversation
Comment on lines
+14
to
+18
| const [period, setPeriod] = useState(() => { | ||
| const now = new Date(); | ||
| return `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, '0')}`; | ||
| }); | ||
| const [year, month] = period.split('-').map(Number); |
There was a problem hiding this comment.
Bug: Partial or invalid text in <input type="month"> fallback inputs triggers API requests with invalid month/year parameters, resulting in 422 errors.
Severity: LOW
Suggested Fix
Validate that the input matches the expected YYYY-MM format (e.g. using a regular expression /^\d{4}-\d{2}$/) before updating period and triggering queries.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location: frontend/src/components/Dashboard.tsx#L14-L18
Potential issue: On browsers lacking native `<input type="month">` support, the control
defaults to a plain text field where `validity.valid` evaluates to true for non-empty
text. Typing partial or invalid input like '2024-' or 'abc' updates `period`, resulting
in invalid `month` and `year` values such as 0 or `NaN`. These values trigger API
requests on each keystroke that fail with 422 errors and cause the UI to display 'Failed
to load revenue data'.
Did we get this right? 👍 / 👎 to inform future reviews.
Author
|
Here's my loom video: When I recorded the video it was more than 18 minutes, so I cut some parts, sorry if that makes the video a little inconvenient. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the three revenue issues reported in the assignment:
Also installs SQLAlchemy’s asyncio dependencies to resolve the missing greenlet error.
One more thing:
I also added
__pycache__to.gitignorebecause the app hot-reloads from the host's repo and generate these files which pollutes git's changes.