Skip to content

solve build errors - #211

Merged
RISHAB-AWASTHI merged 1 commit into
mainfrom
rishab
Mar 17, 2026
Merged

solve build errors#211
RISHAB-AWASTHI merged 1 commit into
mainfrom
rishab

Conversation

@RISHAB-AWASTHI

@RISHAB-AWASTHI RISHAB-AWASTHI commented Mar 17, 2026

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

Release Notes

  • New Features

    • Integrated chat toast notifications for real-time user feedback and updates.
  • Improvements

    • Streamlined navigation sidebar interface for improved usability.
    • Enhanced maintenance request handling and workflows.
    • Updated application form processing with improved data handling.

@coderabbitai

coderabbitai Bot commented Mar 17, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

This PR consolidates multiple cleanup and refinement changes across the application: adds TanStack Devtools and ChatToast to the app root, removes unused imports and the NavLink-based AdminSidebar subcomponent system, adjusts hook return APIs by removing propertyId/unitId from useNewRequestForm, refines type handling for date values, and standardizes React imports by removing default imports in favor of named imports where appropriate.

Changes

Cohort / File(s) Summary
App Configuration
src/App.tsx
Added TanStack React Query Devtools and ChatToast component imports and top-level rendering.
Sidebar Component Restructuring
src/pages/Admin/layout/AdminSidebar.tsx
Removed NavLink import and eliminated SidebarSubLink component along with associated mobile drawer logic, reducing sidebar complexity.
Hook API Updates
src/pages/userdashboard/features/Requests/UserNewRequest.tsx, src/pages/userdashboard/features/Requests/UserRequests.tsx
Removed propertyId and unitId from useNewRequestForm return value; changed useGetLeasesByTenant call to use userId instead of id; expanded handleMenuClick parameter type to accept string or number.
Type Refinements
src/pages/Dashboard/features/Application/NewApplication.tsx, src/pages/Dashboard/features/Application/components/AIApplicationChat.tsx
Added explicit type casting for date values (string | number | Date); wrapped Send button onClick in arrow function for consistency.
Import Cleanup – Lucide Icons
src/pages/Dashboard/features/Maintenance/components/ApplicantsSection.tsx, src/pages/ServiceDashboard/pages/Dashboard/Settings/OnlinePayment/TaxForms.tsx
Removed unused icon imports (Users, X) from lucide-react.
Import Cleanup – React & Router
src/pages/ServiceDashboard/pages/Dashboard/FindJob/JobDetail.tsx, src/pages/ServiceDashboard/pages/Dashboard/Settings/OnlinePayment/BankAccount.tsx, src/pages/ServiceDashboard/pages/Dashboard/Settings/OnlinePayment/Entities.tsx
Removed unused React default imports and useNavigate import, consolidating to named imports only.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Poem

🐰 With whiskers twitching, I hop through the code,
Tidying imports along the dev road,
Hook APIs shimmer, types now cast clear,
Devtools and toasts appear without fear,
Cleanup and polish, the changes are here! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'solve build errors' is vague and generic, failing to describe the specific nature of the changes made across multiple files and components. Replace with a more specific title that describes the actual changes, such as 'Clean up unused imports and adjust event handlers across components' or 'Remove legacy navigation code and refactor React Query integration'.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch rishab
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Tip

CodeRabbit can use your project's `biome` configuration to improve the quality of JS/TS/CSS/JSON code reviews.

Add a configuration file to your project to customize how CodeRabbit runs biome.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/App.tsx (1)

4-5: Gate React Query Devtools to development only at line 865.

TanStackDevtools is currently mounted unconditionally for all environments. Wrap it with import.meta.env.DEV to prevent debug tooling from appearing in production.

Suggested change
-        <TanStackDevtools />
+        {import.meta.env.DEV && <TanStackDevtools initialIsOpen={false} />}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/App.tsx` around lines 4 - 5, TanStackDevtools is being mounted
unconditionally; wrap its rendering in a development-only guard using
import.meta.env.DEV so it only mounts in dev builds. Locate where
TanStackDevtools (imported as ReactQueryDevtools) is rendered in App (symbol
TanStackDevtools) and change the JSX to render it only when import.meta.env.DEV
is truthy (e.g., {import.meta.env.DEV && <TanStackDevtools .../>}). Ensure the
import stays but the component is conditionally included so production bundles
do not mount the devtools.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/pages/Dashboard/features/Application/NewApplication.tsx`:
- Around line 243-245: The branch handling date fields ('dob' and 'moveInDate')
currently uses a truthy check that rejects valid timestamp 0 and can store
Invalid Date; replace the truthy guard with an explicit existence check (e.g.,
value !== undefined && value !== null && value !== '') then construct a Date
from value and validate it (e.g., const d = new Date(value); if
(!isNaN(d.getTime())) assign updates[key] = d else assign undefined) so only
valid Date objects are placed into updates[key] (refer to the handling inside
the NewApplication component where updates[key] is set for 'dob' and
'moveInDate').

---

Nitpick comments:
In `@src/App.tsx`:
- Around line 4-5: TanStackDevtools is being mounted unconditionally; wrap its
rendering in a development-only guard using import.meta.env.DEV so it only
mounts in dev builds. Locate where TanStackDevtools (imported as
ReactQueryDevtools) is rendered in App (symbol TanStackDevtools) and change the
JSX to render it only when import.meta.env.DEV is truthy (e.g.,
{import.meta.env.DEV && <TanStackDevtools .../>}). Ensure the import stays but
the component is conditionally included so production bundles do not mount the
devtools.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a9016f31-3f5c-464f-88eb-04970fd554b8

📥 Commits

Reviewing files that changed from the base of the PR and between 053acaf and a862ef2.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (11)
  • src/App.tsx
  • src/pages/Admin/layout/AdminSidebar.tsx
  • src/pages/Dashboard/features/Application/NewApplication.tsx
  • src/pages/Dashboard/features/Application/components/AIApplicationChat.tsx
  • src/pages/Dashboard/features/Maintenance/components/ApplicantsSection.tsx
  • src/pages/ServiceDashboard/pages/Dashboard/FindJob/JobDetail.tsx
  • src/pages/ServiceDashboard/pages/Dashboard/Settings/OnlinePayment/BankAccount.tsx
  • src/pages/ServiceDashboard/pages/Dashboard/Settings/OnlinePayment/Entities.tsx
  • src/pages/ServiceDashboard/pages/Dashboard/Settings/OnlinePayment/TaxForms.tsx
  • src/pages/userdashboard/features/Requests/UserNewRequest.tsx
  • src/pages/userdashboard/features/Requests/UserRequests.tsx

Comment on lines 243 to 245
} else if (key === 'dob' || key === 'moveInDate') {
updates[key] = value ? new Date(value) : undefined;
updates[key] = value ? new Date(value as string | number | Date) : undefined;
} else {

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.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Read-only verification: inspect producers/transformers of AI form payload date fields.
rg -nP --type=ts --type=tsx -C3 '\bonFormDataReceived\b|\bhandleAIFormData\b|\bdob\b|\bmoveInDate\b'

Repository: scalixity-dev/PMS_Frontend

Length of output: 97


🏁 Script executed:

#!/bin/bash
# Search for dob and moveInDate usage patterns
rg -n 'dob|moveInDate' --type=typescript -C3

Repository: scalixity-dev/PMS_Frontend

Length of output: 104


🏁 Script executed:

#!/bin/bash
# Inspect the full handleAIFormData function context
fd -e tsx -e ts NewApplication.tsx | head -5

Repository: scalixity-dev/PMS_Frontend

Length of output: 198


🏁 Script executed:

#!/bin/bash
# Check the specific file and get context around the changed lines
find . -name "NewApplication.tsx" -type f

Repository: scalixity-dev/PMS_Frontend

Length of output: 131


🏁 Script executed:

#!/bin/bash
# Read the file to see the actual code context around lines 243-245
wc -l ./src/pages/Dashboard/features/Application/NewApplication.tsx

Repository: scalixity-dev/PMS_Frontend

Length of output: 135


🏁 Script executed:

#!/bin/bash
# Read lines around 243-245 in NewApplication.tsx
sed -n '220,270p' ./src/pages/Dashboard/features/Application/NewApplication.tsx

Repository: scalixity-dev/PMS_Frontend

Length of output: 2254


🏁 Script executed:

#!/bin/bash
# Search for dob and moveInDate patterns without type filters
rg -n 'dob|moveInDate' -B2 -A2 ./src/pages/Dashboard/features/Application/NewApplication.tsx

Repository: scalixity-dev/PMS_Frontend

Length of output: 1340


🏁 Script executed:

#!/bin/bash
# Search for where handleAIFormData is called and what data is passed to it
rg -n 'handleAIFormData' -B5 -A5 ./src/pages/Dashboard/features/Application/NewApplication.tsx

Repository: scalixity-dev/PMS_Frontend

Length of output: 766


🏁 Script executed:

#!/bin/bash
# Search for where dob and moveInDate come from - look for API calls or data sources
rg -n 'onFormDataReceived|aiData' -B3 -A3 ./src/pages/Dashboard/features/Application/NewApplication.tsx

Repository: scalixity-dev/PMS_Frontend

Length of output: 744


🏁 Script executed:

#!/bin/bash
# Check if there are any tests or examples showing what data format is expected
find . -name "*test*" -o -name "*spec*" | grep -i "application\|form" | head -10

Repository: scalixity-dev/PMS_Frontend

Length of output: 52


🏁 Script executed:

#!/bin/bash
# Find and inspect AIApplicationChat component to understand data format
find . -name "*AIApplicationChat*" -o -name "*ai-application-chat*"

Repository: scalixity-dev/PMS_Frontend

Length of output: 145


🏁 Script executed:

#!/bin/bash
# Look for AIApplicationChat in component files
rg -l 'AIApplicationChat' --type-add 'tsx:*.tsx' --type-add 'ts:*.ts'

Repository: scalixity-dev/PMS_Frontend

Length of output: 203


🏁 Script executed:

#!/bin/bash
# Search for AIApplicationChat definition
rg -n 'export.*AIApplicationChat|const AIApplicationChat|function AIApplicationChat' -A 10

Repository: scalixity-dev/PMS_Frontend

Length of output: 1698


🏁 Script executed:

#!/bin/bash
# Read AIApplicationChat component to see data format
wc -l ./src/pages/Dashboard/features/Application/components/AIApplicationChat.tsx

Repository: scalixity-dev/PMS_Frontend

Length of output: 149


🏁 Script executed:

#!/bin/bash
# Search for where onFormDataReceived is called in AIApplicationChat
rg -n 'onFormDataReceived' -B 5 -A 5 ./src/pages/Dashboard/features/Application/components/AIApplicationChat.tsx

Repository: scalixity-dev/PMS_Frontend

Length of output: 1131


🏁 Script executed:

#!/bin/bash
# Look for where form data is constructed/parsed in AIApplicationChat
rg -n 'dob|moveInDate|parseFloat|parseInt|new Date' -B 2 -A 2 ./src/pages/Dashboard/features/Application/components/AIApplicationChat.tsx

Repository: scalixity-dev/PMS_Frontend

Length of output: 52


🏁 Script executed:

#!/bin/bash
# Find where pendingFormData is set
rg -n 'setPendingFormData' -B 5 -A 5 ./src/pages/Dashboard/features/Application/components/AIApplicationChat.tsx

Repository: scalixity-dev/PMS_Frontend

Length of output: 1595


🏁 Script executed:

#!/bin/bash
# Read middle section of file to see data processing
sed -n '100,200p' ./src/pages/Dashboard/features/Application/components/AIApplicationChat.tsx

Repository: scalixity-dev/PMS_Frontend

Length of output: 3456


🏁 Script executed:

#!/bin/bash
# Check how date conversion is done elsewhere in the codebase for patterns
rg -n 'new Date' -B 2 -A 2 ./src/pages/Dashboard/features/Application/NewApplication.tsx | head -40

Repository: scalixity-dev/PMS_Frontend

Length of output: 1454


🏁 Script executed:

#!/bin/bash
# Search for date validation patterns in the codebase
rg -n 'isNaN.*getTime|Number.isNaN.*Date' --type=tsx --type=ts -B 2 -A 2

Repository: scalixity-dev/PMS_Frontend

Length of output: 97


Add explicit date validation for dob and moveInDate to prevent invalid dates in state.

On Line 244, the truthy check value ? can discard valid numeric timestamp 0, and it allows Invalid Date objects to be stored in form state. Although the outer condition (Line 227) already filters null/empty strings, the redundant truthy check creates an edge case. Add explicit validity validation after date construction:

Suggested fix
                } else if (key === 'dob' || key === 'moveInDate') {
-                    updates[key] = value ? new Date(value as string | number | Date) : undefined;
+                    if (value !== null && value !== undefined && value !== '') {
+                        const parsed = new Date(value as string | number | Date);
+                        if (!Number.isNaN(parsed.getTime())) {
+                            updates[key] = parsed;
+                        }
+                    }
                 } else {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/pages/Dashboard/features/Application/NewApplication.tsx` around lines 243
- 245, The branch handling date fields ('dob' and 'moveInDate') currently uses a
truthy check that rejects valid timestamp 0 and can store Invalid Date; replace
the truthy guard with an explicit existence check (e.g., value !== undefined &&
value !== null && value !== '') then construct a Date from value and validate it
(e.g., const d = new Date(value); if (!isNaN(d.getTime())) assign updates[key] =
d else assign undefined) so only valid Date objects are placed into updates[key]
(refer to the handling inside the NewApplication component where updates[key] is
set for 'dob' and 'moveInDate').

@RISHAB-AWASTHI
RISHAB-AWASTHI merged commit c270b69 into main Mar 17, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant