feat: disable some features when blockchain is down#1971
Conversation
WalkthroughAdds blockchain-down awareness by reading Changes
Sequence Diagram(s)sequenceDiagram
actor User
participant App as Layout
participant TBP as TopBannerProvider
participant TBanner as TopBanner
participant Settings as SettingsProvider
User->>App: Load page
App->>TBP: Mount TopBannerProvider
TBP->>Settings: read settings (isBlockchainDown)
TBP->>TBP: compute hasBanner (maintenance || isBlockchainDown || credit-card)
App->>TBanner: render selected banner
alt Maintenance open
TBanner-->>User: show Maintenance banner
else Blockchain down
TBanner-->>User: show Network Down banner
else Credit card
TBanner-->>User: show Credit Card banner
else
TBanner-->>User: no banner
end
sequenceDiagram
participant UI as UI Components
participant Settings as SettingsProvider
UI->>Settings: useSettings()
Settings-->>UI: { isBlockchainDown }
alt isBlockchainDown == true
UI-->>UI: set aria-disabled / disabled on deploy/tx buttons
UI-->>UI: hide certificates/authorizations sections
UI-->>UI: prevent query enablement for grants/allowances
else
UI-->>UI: normal interactive behavior
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (3 warnings)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests
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. 🧪 Early access (Sonnet 4.5): enabledWe are currently testing the Sonnet 4.5 model, which is expected to improve code review quality. However, this model may lead to increased noise levels in the review comments. Please disable the early access features if the noise level causes any inconvenience. Note:
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (8)
apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx (4)
100-105: Critical: hasSettings computed incorrectly; nullish-coalescing corrupts typeshasSettings ends up being an object (or other non-boolean), then
??assigns objects to string vars (defaultApiNode/defaultRpcNode). This will break downstream logic at runtime.Apply this diff to fix boolean computation and assignments:
- const hasSettings = - settingsStr && settings.apiEndpoint && settings.rpcEndpoint && settings.selectedNode && nodes?.find(x => x.id === settings.selectedNode?.id); - let defaultApiNode = hasSettings ?? settings.apiEndpoint; - let defaultRpcNode = hasSettings ?? settings.rpcEndpoint; - let selectedNode = hasSettings ?? settings.selectedNode; + const hasSettings = Boolean( + settingsStr && + settings.apiEndpoint && + settings.rpcEndpoint && + settings.selectedNode && + nodes?.some(x => x.id === settings.selectedNode?.id) + ); + let defaultApiNode = settings.apiEndpoint; + let defaultRpcNode = settings.rpcEndpoint; + let selectedNode = settings.selectedNode;
86-99: Set isBlockchainDown based on node statusesThe flag is added but never derived; UI will never enter offline mode. Compute it after fetching statuses and persist in settings.
Apply this diff:
const { data: nodes } = await externalApiHttpClient.get<Array<{ id: string; api: string; rpc: string }>>(selectedNetwork.nodesUrl); const nodesWithStatuses: Array<BlockchainNode> = await Promise.all( nodes.map(async node => { const nodeStatus = await loadNodeStatus(node.rpc); return { ...node, status: nodeStatus.status, latency: nodeStatus.latency, nodeInfo: nodeStatus.nodeInfo }; }) ); + const blockchainDown = nodesWithStatuses.every(n => n.status !== "active" || n.nodeInfo?.sync_info.catching_up !== false); const hasSettings = Boolean( settingsStr && settings.apiEndpoint && settings.rpcEndpoint && settings.selectedNode && nodes?.some(x => x.id === settings.selectedNode?.id) ); let defaultApiNode = settings.apiEndpoint; let defaultRpcNode = settings.rpcEndpoint; let selectedNode = settings.selectedNode; // If the user has a custom node set, use it no matter the status if (hasSettings && settings.isCustomNode) { const nodeStatus = await loadNodeStatus(settings.rpcEndpoint); const customNodeUrl = new URL(settings.apiEndpoint); const customNode: Partial<BlockchainNode> = { status: nodeStatus.status, latency: nodeStatus.latency, nodeInfo: nodeStatus.nodeInfo, id: customNodeUrl.hostname }; - updateSettings({ ...settings, apiEndpoint: defaultApiNode, rpcEndpoint: defaultRpcNode, selectedNode, customNode, nodes: nodesWithStatuses }); + updateSettings({ + ...settings, + apiEndpoint: defaultApiNode, + rpcEndpoint: defaultRpcNode, + selectedNode, + customNode, + nodes: nodesWithStatuses, + isBlockchainDown: blockchainDown + }); } // If the user has no settings or the selected node is inactive, use the fastest available active node if (!hasSettings || (hasSettings && settings.selectedNode?.status === "inactive")) { const randomNode = getFastestNode(nodesWithStatuses); // Use cosmos.directory as a backup if there's no active nodes in the list defaultApiNode = randomNode?.api || "https://rest.cosmos.directory/akash"; defaultRpcNode = randomNode?.rpc || "https://rpc.cosmos.directory/akash"; selectedNode = randomNode || { api: defaultApiNode, rpc: defaultRpcNode, status: "active", latency: 0, nodeInfo: null, id: "https://rest.cosmos.directory/akash" }; - updateSettings({ ...settings, apiEndpoint: defaultApiNode, rpcEndpoint: defaultRpcNode, selectedNode, nodes: nodesWithStatuses }); + updateSettings({ + ...settings, + apiEndpoint: defaultApiNode, + rpcEndpoint: defaultRpcNode, + selectedNode, + nodes: nodesWithStatuses, + isBlockchainDown: blockchainDown + }); } else { defaultApiNode = settings.apiEndpoint; defaultRpcNode = settings.rpcEndpoint; selectedNode = settings.selectedNode; - updateSettings({ ...settings, apiEndpoint: defaultApiNode, rpcEndpoint: defaultRpcNode, selectedNode, nodes: nodesWithStatuses }); + updateSettings({ + ...settings, + apiEndpoint: defaultApiNode, + rpcEndpoint: defaultRpcNode, + selectedNode, + nodes: nodesWithStatuses, + isBlockchainDown: blockchainDown + }); }Also applies to: 118-119, 121-141
265-283: Refresh path should also update isBlockchainDownKeep the flag in sync during status refreshes.
Apply this diff:
setSettings(prevSettings => { const selectedNode = _nodes.find(node => node.id === prevSettings.selectedNode?.id); - const newSettings = { + const blockchainDown = + _isCustomNode + ? (_customNode?.status !== "active" || _customNode?.nodeInfo?.sync_info.catching_up !== false) + : _nodes.every(n => n.status !== "active" || n.nodeInfo?.sync_info.catching_up !== false); + + const newSettings: Settings = { ...prevSettings, nodes: _nodes, selectedNode, - customNode: _customNode + customNode: _customNode, + isBlockchainDown: blockchainDown };
204-211: Avoidanyin TS APIupdateSettings uses
any. Type this asSettingsto comply with codebase TS rules.Apply this diff:
- const updateSettings = (newSettings: any) => { + const updateSettings = (newSettings: Settings) => { setSettings(prevSettings => { clearQueries(prevSettings, newSettings); setLocalStorageItem("settings", JSON.stringify(newSettings)); return newSettings; }); };As per coding guidelines
apps/deploy-web/src/components/layout/Sidebar.tsx (1)
308-319: Aria-disabled on Link doesn’t block keyboard activation; prevent navigation and focusPressing Enter will still navigate. Add an onClick guard and remove from tab order when disabled.
Apply this diff:
- const onDeployClick = () => { - setDeploySdl(null); - }; + const onDeployClick: React.MouseEventHandler<HTMLAnchorElement> = ev => { + if (settings.isBlockchainDown) { + ev.preventDefault(); + ev.stopPropagation(); + return; + } + setDeploySdl(null); + };<Link className={cn(buttonVariants({ variant: "default", size: isNavOpen ? "lg" : "icon" }), "h-[45px] w-full leading-4", { ["h-[45px] w-[45px] min-w-0 pb-2 pt-2"]: !isNavOpen })} href={UrlService.newDeployment()} onClick={onDeployClick} data-testid="sidebar-deploy-button" - aria-disabled={settings.isBlockchainDown} + aria-disabled={settings.isBlockchainDown} + tabIndex={settings.isBlockchainDown ? -1 : undefined} >apps/deploy-web/src/components/home/YourAccount.tsx (1)
155-157: Aria-disabled on Link doesn’t block keyboard activation; prevent navigation and focusPressing Enter on the Deploy link will still navigate. Add an onClick guard and tabIndex handling.
Apply this diff:
- const onDeployClick = () => { - setDeploySdl(null); - }; + const onDeployClick: React.MouseEventHandler<HTMLAnchorElement> = ev => { + if (settings.isBlockchainDown) { + ev.preventDefault(); + ev.stopPropagation(); + return; + } + setDeploySdl(null); + };- <Link + <Link href={UrlService.newDeployment()} className={cn(buttonVariants({ variant: "default" }))} onClick={onDeployClick} - aria-disabled={settings.isBlockchainDown} + aria-disabled={settings.isBlockchainDown} + tabIndex={settings.isBlockchainDown ? -1 : undefined} >Also applies to: 233-241
apps/deploy-web/src/components/deployments/DeploymentList.tsx (2)
187-192: Also disable the top “Deploy” link consistently.Same issue as the empty‑state link; it still navigates while down. Mirror the click guard and disabled styling.
Apply this diff:
- <Link href={UrlService.newDeployment()} className={cn("ml-auto", buttonVariants({ variant: "default", size: "sm" }))} onClick={onDeployClick}> + <Link + href={UrlService.newDeployment()} + className={cn( + "ml-auto", + buttonVariants({ variant: "default", size: "sm" }), + { "pointer-events-none opacity-50": settings.isBlockchainDown } + )} + onClick={e => { + if (settings.isBlockchainDown) { + e.preventDefault(); + return; + } + onDeployClick(); + }} + aria-disabled={settings.isBlockchainDown} + >
175-179: Disable bulk “Close selected” when blockchain is down.This initiates on-chain txs; should be disabled during downtime.
Apply this diff:
- <Button onClick={onCloseSelectedDeployments} color="secondary"> + <Button onClick={onCloseSelectedDeployments} color="secondary" disabled={settings.isBlockchainDown}>
🧹 Nitpick comments (7)
apps/deploy-web/src/components/layout/TopBanner.tsx (1)
24-30: Announce network-down banner to screen readersAdd ARIA semantics so the message is announced when injected.
Apply this diff:
export function NetworkDownBanner() { return ( - <div className="fixed top-0 z-10 flex h-[40px] w-full items-center justify-center bg-primary px-3 py-2 md:space-x-4"> + <div + className="fixed top-0 z-10 flex h-[40px] w-full items-center justify-center bg-primary px-3 py-2 md:space-x-4" + role="status" + aria-live="polite" + aria-atomic="true" + > <span className="text-xs font-semibold text-white md:text-sm">The network is down. Unable to change deployments at the moment.</span> </div> ); }apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx (2)
184-193: Return type of getFastestNode can be undefinedWhen
nodesis empty,nodes[0]is undefined. Consider reflecting this in the return type or guarding callers.Apply this minimal change:
- const getFastestNode = (nodes: Array<BlockchainNode>) => { + const getFastestNode = (nodes: Array<BlockchainNode>): BlockchainNode | undefined => {And keep using optional chaining at call sites (already done).
287-300: Provider value omission
isBlockchainDownis not exposed via the context value. Downstream consumers readingsettings.isBlockchainDownare fine, but if any component needs the flag directly, exposing it here improves ergonomics.Apply this diff if you want to expose it directly:
<SettingsProviderContext.Provider value={{ settings, setSettings: updateSettings, isLoadingSettings, refreshNodeStatuses, isRefreshingNodeStatus, - isSettingsInit + isSettingsInit }} >Alternatively, leave as-is since
settings.isBlockchainDownis present. Based on learningsapps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.tsx (1)
31-36: Remove unused dep in useMemo.isCreatingCert isn’t used in the computation; drop it from deps.
Apply this diff:
- }, [isLocalCertExpired, isCreatingCert, localCert]); + }, [isLocalCertExpired, localCert]);apps/deploy-web/src/components/authorizations/Authorizations.tsx (3)
212-219: Short‑circuit queries when blockchain is down to avoid unnecessary calls.The page hides content, but hooks still fetch. Add enabled: !settings.isBlockchainDown (and/or zero refetchInterval) on data hooks to prevent network churn and errors while down.
Example (apply similarly to all queries on this page):
const { data: granterGrants, isLoading: isLoadingGranterGrants } = useGranterGrants( address, pageIndex.deployment, pageSize.deployment, { refetchInterval: isRefreshing === "granterGrants" ? refreshingInterval : defaultRefetchInterval, select: selectNonMasterGrants, enabled: !settings.isBlockchainDown && !debouncedSearchGrantee, } ); const { data: granteeGrants, isLoading: isLoadingGranteeGrants } = useGranteeGrants(address, { refetchInterval: isRefreshing === "granteeGrants" ? refreshingInterval : defaultRefetchInterval, enabled: !settings.isBlockchainDown, }); const { data: allowancesIssued, isLoading: isLoadingAllowancesIssued } = useAllowancesIssued( address, pageIndex.fee, pageSize.fee, { refetchInterval: isRefreshing === "allowancesIssued" ? refreshingInterval : defaultRefetchInterval, select: selectNonMasterAllowances, enabled: !settings.isBlockchainDown, } );
256-266: Show clear (X) only when there’s a value.Minor UX nit: hide the end icon when input is empty.
Apply this diff:
- endIcon={ - <Button + endIcon={ + !!searchGrantee && ( + <Button variant="text" size="icon" onClick={() => { setSearchGrantee(""); setSearchError(null); }} > <Xmark /> - </Button> + </Button> + ) }
458-459: Fix grammar in confirmation copy.Apply this diff:
- Deleting allowance to will revoke their ability to fees on your behalf. + Deleting allowances will revoke their ability to pay fees on your behalf.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (13)
apps/deploy-web/src/components/authorizations/Authorizations.tsx(3 hunks)apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.tsx(3 hunks)apps/deploy-web/src/components/deployments/DeploymentList.tsx(1 hunks)apps/deploy-web/src/components/home/YourAccount.tsx(3 hunks)apps/deploy-web/src/components/layout/Layout.tsx(3 hunks)apps/deploy-web/src/components/layout/Sidebar.tsx(3 hunks)apps/deploy-web/src/components/layout/TopBanner.tsx(1 hunks)apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.tsx(6 hunks)apps/deploy-web/src/components/new-deployment/ManifestEdit.tsx(1 hunks)apps/deploy-web/src/components/settings/SettingsContainer.tsx(3 hunks)apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.tsx(3 hunks)apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx(2 hunks)packages/ui/components/button.tsx(1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
Never use type any or cast to type any. Always define the proper TypeScript types.
Files:
apps/deploy-web/src/components/layout/Sidebar.tsxapps/deploy-web/src/components/wallet/ConnectManagedWalletButton.tsxapps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.tsxapps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.tsxapps/deploy-web/src/components/layout/TopBanner.tsxpackages/ui/components/button.tsxapps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsxapps/deploy-web/src/components/layout/Layout.tsxapps/deploy-web/src/components/settings/SettingsContainer.tsxapps/deploy-web/src/components/deployments/DeploymentList.tsxapps/deploy-web/src/components/home/YourAccount.tsxapps/deploy-web/src/components/new-deployment/ManifestEdit.tsxapps/deploy-web/src/components/authorizations/Authorizations.tsx
**/*.{js,ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
**/*.{js,ts,tsx}: Never use deprecated methods from libraries.
Don't add unnecessary comments to the code
Files:
apps/deploy-web/src/components/layout/Sidebar.tsxapps/deploy-web/src/components/wallet/ConnectManagedWalletButton.tsxapps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.tsxapps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.tsxapps/deploy-web/src/components/layout/TopBanner.tsxpackages/ui/components/button.tsxapps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsxapps/deploy-web/src/components/layout/Layout.tsxapps/deploy-web/src/components/settings/SettingsContainer.tsxapps/deploy-web/src/components/deployments/DeploymentList.tsxapps/deploy-web/src/components/home/YourAccount.tsxapps/deploy-web/src/components/new-deployment/ManifestEdit.tsxapps/deploy-web/src/components/authorizations/Authorizations.tsx
🧬 Code graph analysis (9)
apps/deploy-web/src/components/layout/Sidebar.tsx (1)
apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx (1)
useSettings(303-305)
apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.tsx (1)
apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx (1)
useSettings(303-305)
apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.tsx (1)
apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx (1)
useSettings(303-305)
apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.tsx (1)
apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx (1)
useSettings(303-305)
apps/deploy-web/src/components/layout/Layout.tsx (3)
apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx (1)
useSettings(303-305)apps/deploy-web/src/hooks/useHasCreditCardBanner.ts (1)
useHasCreditCardBanner(11-35)apps/deploy-web/src/components/layout/TopBanner.tsx (1)
NetworkDownBanner(24-30)
apps/deploy-web/src/components/settings/SettingsContainer.tsx (3)
apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx (1)
useSettings(303-305)apps/deploy-web/src/components/shared/Fieldset.tsx (1)
Fieldset(12-23)apps/deploy-web/src/components/settings/CertificateList.tsx (1)
CertificateList(12-114)
apps/deploy-web/src/components/deployments/DeploymentList.tsx (3)
apps/deploy-web/src/utils/urlUtils.ts (1)
UrlService(16-81)apps/provider-console/src/utils/styleUtils.ts (1)
cn(4-6)packages/ui/components/button.tsx (1)
buttonVariants(46-46)
apps/deploy-web/src/components/home/YourAccount.tsx (1)
apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx (1)
useSettings(303-305)
apps/deploy-web/src/components/authorizations/Authorizations.tsx (2)
apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx (1)
useSettings(303-305)apps/deploy-web/src/components/settings/SettingsLayout.tsx (1)
SettingsLayout(24-58)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
- GitHub Check: test-build
- GitHub Check: test-build
- GitHub Check: validate / validate-app
- GitHub Check: test-build
- GitHub Check: Validate local packages
🔇 Additional comments (9)
packages/ui/components/button.tsx (1)
9-9: ARIA-disabled styling: LGTM; verify keyboard interaction at call sitesThe added aria-[disabled='true'] classes are correct and consistent with disabled styling.
Please ensure anchor/Link usages that rely on aria-disabled also prevent keyboard activation (Enter/Space) via onClick guards and/or tabIndex adjustments. See my comments in Sidebar.tsx and YourAccount.tsx.
apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx (1)
28-29: Settings shape extension: LGTMAdding isBlockchainDown to Settings and defaultSettings looks good and non-breaking.
Also applies to: 48-50
apps/deploy-web/src/components/layout/Sidebar.tsx (1)
64-65: Import and usage: LGTMReading settings from context here is appropriate.
apps/deploy-web/src/components/settings/SettingsContainer.tsx (1)
12-12: Hiding Certificates when blockchain is down: LGTMThis aligns with the offline-mode requirement to hide the certificates list.
Confirm that Authorizations are similarly hidden per the issue scope.
Also applies to: 25-25, 73-77
apps/deploy-web/src/components/new-deployment/ManifestEdit.tsx (1)
351-355: Create Deployment disabled during downtime: LGTMCorrectly gates the action using settings.isBlockchainDown.
apps/deploy-web/src/components/home/YourAccount.tsx (1)
45-46: Context usage: LGTMConsuming settings here is appropriate and consistent.
apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.tsx (1)
21-22: Disable Start Trial when blockchain is down: LGTMComposed disabled state with isWalletLoading is correct.
Also applies to: 40-41
apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.tsx (1)
46-48: LGTM: Button disables certificate creation when blockchain is down.Gates the action correctly via disabled.
apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.tsx (1)
414-417: LGTM on disabling tx actions; confirm manifest re-send behavior.
- Disabling Close Deployment and Accept Bid during downtime looks correct.
- You allow “Re-send Manifest” when there’s an active bid even if the blockchain is down. If that’s intended (no chain tx), keep it; otherwise, include settings.isBlockchainDown in the hasActiveBid path too.
- Ensure CustomDropdownLinkItem truly blocks onClick when disabled.
Also applies to: 427-429, 449-452, 601-608
1baf6e4 to
3e5662c
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
apps/deploy-web/src/components/authorizations/Authorizations.tsx (1)
69-88: Gate data fetching while the chain is offline.We hide the authorizations UI when
settings.isBlockchainDownis true, but all of the queries (useGranterGrants,useGranteeGrants,useAllowancesIssued,useAllowance, and the exact-grantee lookup) still spin. When the chain/API is actually down, these hooks keep retrying and surface toast errors, andLayoutstays in the global loading state, so the offline banner is masked. We should short-circuit the queries through theirenabledflag (and/or early returns) whenever the chain is down.One example fix:
const { data: granterGrants, isLoading: isLoadingGranterGrants } = useGranterGrants(address, pageIndex.deployment, pageSize.deployment, { - refetchInterval: isRefreshing === "granterGrants" ? refreshingInterval : defaultRefetchInterval, - select: selectNonMasterGrants, - enabled: !debouncedSearchGrantee + refetchInterval: isRefreshing === "granterGrants" ? refreshingInterval : defaultRefetchInterval, + select: selectNonMasterGrants, + enabled: !settings.isBlockchainDown && !debouncedSearchGrantee });Please apply the same guard to the other grant/allowance hooks so the page stays quiet in offline mode.
🧹 Nitpick comments (4)
apps/deploy-web/src/components/layout/TopBanner.tsx (1)
24-30: Expose the banner state to screen readersRight now the banner silently appears in the DOM, but without
role/aria-liveassistive tech won’t announce that the network is down. Add a polite live region (orrole="alert"if you prefer assertive) so the status change is communicated.-export function NetworkDownBanner() { - return ( - <div className="fixed top-0 z-10 flex h-[40px] w-full items-center justify-center bg-primary px-3 py-2 md:space-x-4"> +export function NetworkDownBanner() { + return ( + <div role="status" aria-live="polite" className="fixed top-0 z-10 flex h-[40px] w-full items-center justify-center bg-primary px-3 py-2 md:space-x-4"> <span className="text-xs font-semibold text-white md:text-sm">The network is down. Unable to change deployments at the moment.</span> </div> ); }apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx (1)
365-366: Setup accepts isBlockchainDown: good; add an assertion when down.Now that setup can simulate downtime, add at least one expectation proving primary actions are disabled when isBlockchainDown is true (e.g., Accept Bid/Re-send Manifest and Close Deployment). As per coding guidelines for apps//.spec.tsx, prefer queryBy* in expectations.
Example (inside existing "lease creation" describe):
+ it("disables lease actions when blockchain is down", async () => { + await setupLeaseCreation({ isBlockchainDown: true }); + await waitFor(() => { + expect(screen.queryByRole("button", { name: /Accept Bid/i })).toBeDisabled(); + }); + });As per coding guidelines
apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.spec.tsx (1)
42-46: Downtime param supported: add a disabled-state check.Add a test that sets isBlockchainDown: true and expects the button to be disabled. In this package, use queryBy* per guidelines.
Example:
+ it("disables Create Certificate when blockchain is down", () => { + setup({ isBlockchainDown: true }); + expect(screen.queryByRole("button", { name: /create certificate/i })).toBeDisabled(); + });As per coding guidelines
apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.tsx (1)
44-49: Guard onClick to no-op when disabled (robust with asChild).Button disabled blocks clicks for native buttons, but if rendered asChild (e.g., anchor), disabled doesn’t stop onClick. Add a defensive guard.
Apply this diff:
- <d.Button + <d.Button className={warningText ? "mt-4" : ""} {...buttonProps} disabled={buttonProps?.disabled || settings.isBlockchainDown || isCreatingCert} - onClick={_createCertificate} + onClick={e => { + if (buttonProps?.disabled || settings.isBlockchainDown || isCreatingCert) { + e.preventDefault(); + return; + } + _createCertificate(); + }} >
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (15)
apps/deploy-web/src/components/authorizations/Authorizations.tsx(3 hunks)apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.spec.tsx(2 hunks)apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.tsx(3 hunks)apps/deploy-web/src/components/deployments/DeploymentList.tsx(1 hunks)apps/deploy-web/src/components/home/YourAccount.tsx(3 hunks)apps/deploy-web/src/components/layout/Layout.tsx(3 hunks)apps/deploy-web/src/components/layout/Sidebar.tsx(3 hunks)apps/deploy-web/src/components/layout/TopBanner.tsx(1 hunks)apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx(2 hunks)apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.tsx(7 hunks)apps/deploy-web/src/components/new-deployment/ManifestEdit.tsx(1 hunks)apps/deploy-web/src/components/settings/SettingsContainer.tsx(3 hunks)apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.tsx(3 hunks)apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx(2 hunks)packages/ui/components/button.tsx(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (5)
- apps/deploy-web/src/components/new-deployment/ManifestEdit.tsx
- apps/deploy-web/src/components/layout/Layout.tsx
- apps/deploy-web/src/components/layout/Sidebar.tsx
- apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.tsx
- apps/deploy-web/src/components/settings/SettingsContainer.tsx
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
Never use type any or cast to type any. Always define the proper TypeScript types.
Files:
apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsxapps/deploy-web/src/components/home/YourAccount.tsxapps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.spec.tsxapps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.tsxapps/deploy-web/src/components/deployments/DeploymentList.tsxapps/deploy-web/src/components/layout/TopBanner.tsxapps/deploy-web/src/components/authorizations/Authorizations.tsxapps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsxpackages/ui/components/button.tsxapps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.tsx
**/*.{js,ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
**/*.{js,ts,tsx}: Never use deprecated methods from libraries.
Don't add unnecessary comments to the code
Files:
apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsxapps/deploy-web/src/components/home/YourAccount.tsxapps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.spec.tsxapps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.tsxapps/deploy-web/src/components/deployments/DeploymentList.tsxapps/deploy-web/src/components/layout/TopBanner.tsxapps/deploy-web/src/components/authorizations/Authorizations.tsxapps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsxpackages/ui/components/button.tsxapps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.tsx
**/*.spec.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/no-jest-mock.mdc)
Don't use
jest.mock()to mock dependencies in test files. Instead, usejest-mock-extendedto create mocks and pass mocks as dependencies to the service under test.
**/*.spec.{ts,tsx}: Usesetupfunction instead ofbeforeEachin test files
setupfunction must be at the bottom of the rootdescribeblock in test files
setupfunction creates an object under test and returns it
setupfunction should accept a single parameter with inline type definition
Don't use shared state insetupfunction
Don't specify return type ofsetupfunction
Files:
apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.spec.tsxapps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx
apps/{deploy-web,provider-console}/**/*.spec.tsx
📄 CodeRabbit inference engine (.cursor/rules/query-by-in-tests.mdc)
Use
queryBymethods instead ofgetBymethods in test expectations in.spec.tsxfiles
Files:
apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.spec.tsxapps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx
🧬 Code graph analysis (4)
apps/deploy-web/src/components/home/YourAccount.tsx (3)
apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx (1)
useSettings(303-305)apps/deploy-web/src/utils/urlUtils.ts (1)
UrlService(16-81)apps/provider-console/src/utils/styleUtils.ts (1)
cn(4-6)
apps/deploy-web/src/components/deployments/DeploymentList.tsx (2)
apps/deploy-web/src/utils/urlUtils.ts (1)
UrlService(16-81)apps/provider-console/src/utils/styleUtils.ts (1)
cn(4-6)
apps/deploy-web/src/components/authorizations/Authorizations.tsx (2)
apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx (1)
useSettings(303-305)apps/deploy-web/src/components/settings/SettingsLayout.tsx (1)
SettingsLayout(24-58)
apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.tsx (2)
apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.tsx (1)
DEPENDENCIES(66-104)apps/deploy-web/src/context/CertificateProvider/CertificateProviderContext.tsx (1)
DEPENDENCIES(63-68)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
- GitHub Check: test-build
- GitHub Check: test-build
- GitHub Check: validate / validate-app
- GitHub Check: test-build
- GitHub Check: Validate local packages
🔇 Additional comments (13)
apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx (1)
460-476: Mocked useSettings wiring looks correct.The mock shape matches Settings and unblocks downtime simulations.
packages/ui/components/button.tsx (1)
9-9: ARIA-disabled styling: LGTM; note anchor keyboard activation.The new aria-[disabled] utilities are good. Remember: on anchors/links, aria-disabled + pointer-events-none won’t stop keyboard activation. Ensure Link wrappers also preventDefault() when aria-disabled.
apps/deploy-web/src/components/home/YourAccount.tsx (1)
16-16: New dependency useSettings: LGTM.apps/deploy-web/src/components/deployments/DeploymentList.tsx (1)
227-232: Aria-disabled on Link doesn’t prevent navigation; use click guard.This was already flagged earlier for this exact spot. Please apply the previously suggested onClick preventDefault when down.
apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.spec.tsx (1)
58-73: Mocked useSettings wiring looks correct.apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx (1)
21-29: Settings type and defaults extended with isBlockchainDown: LGTM.Merges cleanly with persisted settings and defaults to false.
Also applies to: 42-50
apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.tsx (1)
25-26: Good: consuming settings for gating.apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.tsx (6)
35-35: New dependency useSettings: LGTM.
102-104: Injected dependency added: LGTM.
115-116: Consuming settings: LGTM.
415-417: Dropdown “Close Deployment” disabled when down: LGTM.
450-451: All-closed flow disabled when down: LGTM.
602-609: Trial/zero-bids close button disabled when down: LGTM.
apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.tsx
Outdated
Show resolved
Hide resolved
3e5662c to
8789cba
Compare
There was a problem hiding this comment.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx (1)
204-211: Type safety: avoid any in updateSettingsupdateSettings(newSettings: any) violates our TS guidelines. Type it as Settings.
As per coding guidelines
- const updateSettings = (newSettings: any) => { + const updateSettings = (newSettings: Settings) => {
🧹 Nitpick comments (1)
apps/deploy-web/src/components/authorizations/Authorizations.tsx (1)
212-218: Good offline gating, but pause queries when downRendering a lightweight offline view is good. However, the data hooks above still fire and may error/spam logs while the chain is down. Add enabled: !settings.isBlockchainDown to:
- useGranterGrants, useGranteeGrants
- useAllowancesIssued
- useExactDeploymentGrantsQuery (keep enabled: false, but guard refetch triggers)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (15)
apps/deploy-web/src/components/authorizations/Authorizations.tsx(3 hunks)apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.spec.tsx(2 hunks)apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.tsx(3 hunks)apps/deploy-web/src/components/deployments/DeploymentList.tsx(1 hunks)apps/deploy-web/src/components/home/YourAccount.tsx(3 hunks)apps/deploy-web/src/components/layout/Layout.tsx(3 hunks)apps/deploy-web/src/components/layout/Sidebar.tsx(3 hunks)apps/deploy-web/src/components/layout/TopBanner.tsx(1 hunks)apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx(3 hunks)apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.tsx(7 hunks)apps/deploy-web/src/components/new-deployment/ManifestEdit.tsx(1 hunks)apps/deploy-web/src/components/settings/SettingsContainer.tsx(3 hunks)apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.tsx(3 hunks)apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx(2 hunks)packages/ui/components/button.tsx(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (10)
- apps/deploy-web/src/components/new-deployment/ManifestEdit.tsx
- apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.spec.tsx
- apps/deploy-web/src/components/settings/SettingsContainer.tsx
- apps/deploy-web/src/components/home/YourAccount.tsx
- apps/deploy-web/src/components/layout/TopBanner.tsx
- apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx
- packages/ui/components/button.tsx
- apps/deploy-web/src/components/layout/Sidebar.tsx
- apps/deploy-web/src/components/layout/Layout.tsx
- apps/deploy-web/src/components/deployments/DeploymentList.tsx
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
Never use type any or cast to type any. Always define the proper TypeScript types.
Files:
apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.tsxapps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsxapps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.tsxapps/deploy-web/src/components/authorizations/Authorizations.tsxapps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.tsx
**/*.{js,ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
**/*.{js,ts,tsx}: Never use deprecated methods from libraries.
Don't add unnecessary comments to the code
Files:
apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.tsxapps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsxapps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.tsxapps/deploy-web/src/components/authorizations/Authorizations.tsxapps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.tsx
🧬 Code graph analysis (3)
apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.tsx (1)
apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx (1)
useSettings(303-305)
apps/deploy-web/src/components/authorizations/Authorizations.tsx (2)
apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx (1)
useSettings(303-305)apps/deploy-web/src/components/settings/SettingsLayout.tsx (1)
SettingsLayout(24-58)
apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.tsx (2)
apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.tsx (1)
DEPENDENCIES(66-104)apps/deploy-web/src/context/CertificateProvider/CertificateProviderContext.tsx (1)
DEPENDENCIES(63-68)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
- GitHub Check: validate / validate-app
- GitHub Check: test-build
- GitHub Check: test-build
- GitHub Check: test-build
- GitHub Check: Validate local packages
🔇 Additional comments (7)
apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.tsx (1)
44-49: LGTM: respects blockchain-down stateDisabling the certificate creation button when isBlockchainDown or creating is in progress is correct and aligns with the objective.
apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.tsx (6)
102-104: LGTM: exposing useSettings as a dependencyAdding useSettings to DEPENDENCIES is consistent with the DI pattern used here.
115-116: LGTM: local access to settingsConsuming settings via d.useSettings() is correct.
415-417: LGTM: menu action disabled while downDisabling “Close Deployment” when isBlockchainDown prevents tx initiation during downtime.
450-452: LGTM: all-closed action gatedThe “Close Deployment” button is correctly disabled under downtime.
602-609: LGTM: trial card close action gatedThe “Close Deployment” CTA in the trial empty-state respects isBlockchainDown.
428-431: Bug: “Re-send Manifest” still enabled when blockchain is downWhen hasActiveBid is true, the button is always enabled, violating the offline rule and enabling a path that can create a cert/tx on click.
Apply:
- disabled={ - hasActiveBid ? false : settings.isBlockchainDown || dseqList.some(gseq => !selectedBids[gseq]) || isSendingManifest || isCreatingLeases - } + disabled={ + settings.isBlockchainDown || + isSendingManifest || + isCreatingLeases || + (!hasActiveBid && dseqList.some(gseq => !selectedBids[gseq])) + }Please ensure tests cover both paths:
- “Accept Bid” disabled when down (existing).
- “Re-send Manifest” disabled when down (hasActiveBid = true).
Run:
#!/bin/bash rg -nP -C2 'Re-send Manifest|data-testid="create-lease-button"' apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx
apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx
Show resolved
Hide resolved
8789cba to
57e842c
Compare
There was a problem hiding this comment.
Actionable comments posted: 5
🧹 Nitpick comments (4)
apps/deploy-web/src/components/authorizations/Authorizations.tsx (1)
256-266: Add accessible labels to icon-only buttonsIcon-only buttons need accessible names.
- <Button + <Button variant="text" size="icon" onClick={() => { setSearchGrantee(""); setSearchError(null); }} + aria-label="Clear search" + title="Clear search" > <Xmark /> </Button>- <Button variant="ghost" size="icon" className="rounded-full" onClick={onRefreshSearchClick}> + <Button + variant="ghost" + size="icon" + className="rounded-full" + onClick={onRefreshSearchClick} + aria-label="Refresh search" + title="Refresh search" + > <Refresh className="text-xs" /> </Button>Also applies to: 268-271
apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.tsx (1)
307-339: Defense-in-depth: Early-return in actions when offlineRecommend guarding createLease (and similarly handleCloseDeployment) against accidental invocation (e.g., programmatic click) when settings.isBlockchainDown is true. Show an error and return early.
Example:
async function createLease() { setIsCreatingLeases(true); try { + if (settings.isBlockchainDown) { + enqueueSnackbar(<Snackbar title="Network unavailable" subTitle="Blockchain is down. Please try again later." iconVariant="error" />, { + variant: "error", + autoHideDuration: 5000 + }); + return; + }Optionally mirror the same check at the start of handleCloseDeployment.
apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.spec.tsx (2)
9-12: Use Testing Library queryBy and role-based assertions.*Per repo guideline for apps/deploy-web/*.spec.tsx, prefer queryBy methods (and role where possible) and use toBeDisabled/toBeEnabled.
Apply this diff:
- it("renders button enabled when blockchain is up", () => { - const { getByText } = setup({ isBlockchainDown: false }); - - expect(getByText("Start Trial").parentElement).not.toHaveAttribute("disabled"); - }); + it("renders button enabled when blockchain is up", () => { + const { queryByRole } = setup({ isBlockchainDown: false }); + expect(queryByRole("button", { name: /start trial/i })).not.toBeDisabled(); + }); @@ - it("renders button disabled when blockchain is down", () => { - const { getByText } = setup({ isBlockchainDown: true }); - - expect(getByText("Start Trial").parentElement).toHaveAttribute("disabled"); - }); + it("renders button disabled when blockchain is down", () => { + const { queryByRole } = setup({ isBlockchainDown: true }); + expect(queryByRole("button", { name: /start trial/i })).toBeDisabled(); + });As per coding guidelines
Also applies to: 15-18
20-20: Remove unused setup parameter.isRegistered is unused; drop it to avoid noise.
Apply this diff:
- function setup(input?: { isRegistered?: boolean; isBlockchainDown?: boolean }) { + function setup(input?: { isBlockchainDown?: boolean }) {
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (16)
apps/deploy-web/src/components/authorizations/Authorizations.tsx(3 hunks)apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.spec.tsx(2 hunks)apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.tsx(3 hunks)apps/deploy-web/src/components/deployments/DeploymentList.tsx(1 hunks)apps/deploy-web/src/components/home/YourAccount.tsx(3 hunks)apps/deploy-web/src/components/layout/Layout.tsx(3 hunks)apps/deploy-web/src/components/layout/Sidebar.tsx(3 hunks)apps/deploy-web/src/components/layout/TopBanner.tsx(1 hunks)apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx(3 hunks)apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.tsx(7 hunks)apps/deploy-web/src/components/new-deployment/ManifestEdit.tsx(1 hunks)apps/deploy-web/src/components/settings/SettingsContainer.tsx(3 hunks)apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.spec.tsx(1 hunks)apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.tsx(2 hunks)apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx(2 hunks)packages/ui/components/button.tsx(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (9)
- apps/deploy-web/src/components/settings/SettingsContainer.tsx
- apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.tsx
- packages/ui/components/button.tsx
- apps/deploy-web/src/components/layout/Sidebar.tsx
- apps/deploy-web/src/components/new-deployment/ManifestEdit.tsx
- apps/deploy-web/src/components/deployments/DeploymentList.tsx
- apps/deploy-web/src/components/layout/TopBanner.tsx
- apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx
- apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.spec.tsx
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
Never use type any or cast to type any. Always define the proper TypeScript types.
Files:
apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.tsxapps/deploy-web/src/components/wallet/ConnectManagedWalletButton.spec.tsxapps/deploy-web/src/components/home/YourAccount.tsxapps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.tsxapps/deploy-web/src/components/authorizations/Authorizations.tsxapps/deploy-web/src/components/layout/Layout.tsxapps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx
**/*.{js,ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
**/*.{js,ts,tsx}: Never use deprecated methods from libraries.
Don't add unnecessary comments to the code
Files:
apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.tsxapps/deploy-web/src/components/wallet/ConnectManagedWalletButton.spec.tsxapps/deploy-web/src/components/home/YourAccount.tsxapps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.tsxapps/deploy-web/src/components/authorizations/Authorizations.tsxapps/deploy-web/src/components/layout/Layout.tsxapps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx
**/*.spec.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/no-jest-mock.mdc)
Don't use
jest.mock()to mock dependencies in test files. Instead, usejest-mock-extendedto create mocks and pass mocks as dependencies to the service under test.
**/*.spec.{ts,tsx}: Usesetupfunction instead ofbeforeEachin test files
setupfunction must be at the bottom of the rootdescribeblock in test files
setupfunction creates an object under test and returns it
setupfunction should accept a single parameter with inline type definition
Don't use shared state insetupfunction
Don't specify return type ofsetupfunction
Files:
apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.spec.tsxapps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx
apps/{deploy-web,provider-console}/**/*.spec.tsx
📄 CodeRabbit inference engine (.cursor/rules/query-by-in-tests.mdc)
Use
queryBymethods instead ofgetBymethods in test expectations in.spec.tsxfiles
Files:
apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.spec.tsxapps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx
🧬 Code graph analysis (6)
apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.tsx (2)
apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.tsx (1)
DEPENDENCIES(66-104)apps/deploy-web/src/context/CertificateProvider/CertificateProviderContext.tsx (1)
DEPENDENCIES(63-68)
apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.spec.tsx (2)
apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.tsx (1)
ConnectManagedWalletButton(27-53)apps/deploy-web/src/hooks/useFlag.tsx (1)
useFlag(8-8)
apps/deploy-web/src/components/home/YourAccount.tsx (3)
apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx (1)
useSettings(303-305)apps/deploy-web/src/utils/urlUtils.ts (1)
UrlService(16-81)apps/provider-console/src/utils/styleUtils.ts (1)
cn(4-6)
apps/deploy-web/src/components/authorizations/Authorizations.tsx (3)
apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx (1)
useSettings(303-305)apps/deploy-web/src/components/settings/SettingsLayout.tsx (1)
SettingsLayout(24-58)apps/deploy-web/src/components/shared/Fieldset.tsx (1)
Fieldset(12-23)
apps/deploy-web/src/components/layout/Layout.tsx (3)
apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx (1)
useSettings(303-305)apps/deploy-web/src/hooks/useHasCreditCardBanner.ts (1)
useHasCreditCardBanner(11-35)apps/deploy-web/src/components/layout/TopBanner.tsx (1)
NetworkDownBanner(21-27)
apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx (2)
apps/deploy-web/src/components/new-deployment/BidGroup.tsx (1)
BidGroup(32-160)apps/deploy-web/tests/seeders/bid.ts (1)
buildRpcBid(7-81)
🪛 GitHub Check: validate / validate-app
apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.spec.tsx
[failure] 5-5:
All imports in the declaration are only used as types. Use import type
[failure] 1-1:
Run autofix to sort these imports!
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: test-build
- GitHub Check: test-build
- GitHub Check: test-build
- GitHub Check: Validate local packages
🔇 Additional comments (19)
apps/deploy-web/src/components/home/YourAccount.tsx (1)
234-238: Disabled Deploy link still fires navigation and handler
aria-disabledon a NextLinkis cosmetic—clicks (and keyboard activation) still navigate and runonDeployClick, so the Deploy flow stays reachable whilesettings.isBlockchainDownis true. Prevent the default action (and stop propagation) when offline before callingonDeployClick.- onClick={onDeployClick} + onClick={event => { + if (settings.isBlockchainDown) { + event.preventDefault(); + event.stopPropagation(); + return; + } + onDeployClick(); + }}apps/deploy-web/src/components/layout/Layout.tsx (1)
74-107: Hide CreditCardBanner when the network is down to prevent banner overlap
CreditCardBannerandNetworkDownBannerboth render attop:0, so whensettings.isBlockchainDownis true the banners stack on top of each other. Gate the credit-card banner behind the blockchain-up state (and adjusthasBanneraccordingly) so only one top banner is visible at a time.- const hasBanner = hasCreditCardBanner || isMaintenanceBannerOpen || settings.isBlockchainDown; + const hasBanner = (!settings.isBlockchainDown && hasCreditCardBanner) || isMaintenanceBannerOpen || settings.isBlockchainDown; … - {hasCreditCardBanner && <CreditCardBanner />} - {settings.isBlockchainDown && ( - <> - <NetworkDownBanner /> - </> - )} + {!settings.isBlockchainDown && hasCreditCardBanner && <CreditCardBanner />} + {settings.isBlockchainDown && <NetworkDownBanner />}apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.tsx (1)
44-48: LGTM – disables certificate actions when offlineThe button now respects the blockchain-down flag while preserving the existing busy-state guard. Nice alignment with the offline-mode requirements.
apps/deploy-web/src/components/authorizations/Authorizations.tsx (4)
10-10: LGTM: settings wiring addedImporting useSettings here makes sense for the offline gating.
50-50: Verify SettingsProvider always suppliessettingsEnsure SettingsProviderContext has a non-null default and this route is always wrapped; otherwise
settingscould be undefined at runtime.
221-233: LGTM: header actions only in blockchain-up branchActions are hidden in offline mode and gated by
address.
458-459: Fix copy: incorrect sentence (previous feedback still applies)“Deleting allowance to will revoke their ability to fees on your behalf.” → grammar issue.
- Deleting allowance to will revoke their ability to fees on your behalf. + Deleting this allowance will revoke their ability to pay fees on your behalf.apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.tsx (7)
34-34: Good: Settings wired inImporting useSettings is correct for gating UI on chain downtime.
102-104: Good: Dependencies surface extendedExposing useBlock and useSettings through DEPENDENCIES keeps the component testable.
115-115: Good: Reading settings from providerUsing d.useSettings() locally simplifies conditional UI logic.
415-417: Good: Disable Close Deployment in menu when chain is downMatches requirement to block chain transactions during downtime.
450-452: Good: All-closed path gatedClose Deployment action is correctly disabled when blockchain is down.
602-609: Good: Trial warning card action gatedClose Deployment here also respects isBlockchainDown.
428-431: Bug: “Re-send Manifest” remains enabled when blockchain is downWhen hasActiveBid is true, the button is always enabled, which can trigger certificate creation (a chain tx) if the local cert is expired. Must still disable when settings.isBlockchainDown. This was flagged previously and remains unresolved.
Apply this diff:
- disabled={ - hasActiveBid ? false : settings.isBlockchainDown || dseqList.some(gseq => !selectedBids[gseq]) || isSendingManifest || isCreatingLeases - } + disabled={ + settings.isBlockchainDown || + isSendingManifest || + isCreatingLeases || + (!hasActiveBid && dseqList.some(gseq => !selectedBids[gseq])) + }apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx (2)
395-396: Good: setup accepts isBlockchainDownPropagating this flag through setup enables targeted scenarios.
491-506: Good: useSettings mock includes isBlockchainDownMocking SettingsProvider with isBlockchainDown ensures component gating is exercised in tests.
apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.spec.tsx (3)
20-52: Good test structure with setup pattern.Setup function is at the bottom of the root describe, takes a single param with inline type, returns the object under test, and avoids shared state.
As per coding guidelines
1-5: Sort imports to satisfy lint autofix.Import order is failing lint. Please run the repo’s autofix to sort imports.
Run locally:
- pnpm lint --fix
- or npx eslint --fix apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.spec.tsx
Based on static analysis hints
5-5: Retain useFlag as a value import or update the annotation
useFlagis used inReturnType<typeof useFlag>, so it must remain a value import. If you’d rather use a type-only import, switch your mock’s annotation to the exportedFeatureFlagHooktype instead ofReturnType<typeof useFlag>, for example:import type { FeatureFlagHook } from "@src/hooks/useFlag"; const mockUseFlag: FeatureFlagHook = jest.fn((flag) => { /* … */ });Otherwise, keep the original
import { useFlag }so thetypeof useFlagquery still resolves.Likely an incorrect or invalid review comment.
apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx
Show resolved
Hide resolved
apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.spec.tsx
Show resolved
Hide resolved
57e842c to
04054b9
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
apps/deploy-web/src/components/layout/Sidebar.tsx (1)
309-316: Sidebar “Deploy” link still navigable; prevent navigation when offline
aria-disabledalone doesn’t block clicks. Users can still navigate to New Deployment. Prevent navigation (and keyboard activation) whenisBlockchainDown.Apply:
- <Link + <Link className={cn(buttonVariants({ variant: "default", size: isNavOpen ? "lg" : "icon" }), "h-[45px] w-full leading-4", { ["h-[45px] w-[45px] min-w-0 pb-2 pt-2"]: !isNavOpen })} - href={UrlService.newDeployment()} - onClick={onDeployClick} + href={settings.isBlockchainDown ? "#" : UrlService.newDeployment()} + onClick={e => { + if (settings.isBlockchainDown) { + e.preventDefault(); + return; + } + onDeployClick(); + }} data-testid="sidebar-deploy-button" - aria-disabled={settings.isBlockchainDown} + aria-disabled={settings.isBlockchainDown} + tabIndex={settings.isBlockchainDown ? -1 : undefined} + className={cn( + buttonVariants({ variant: "default", size: isNavOpen ? "lg" : "icon" }), + "h-[45px] w-full leading-4", + { ["h-[45px] w-[45px] min-w-0 pb-2 pt-2"]: !isNavOpen }, + { ["pointer-events-none opacity-60"]: settings.isBlockchainDown } + )} >
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (16)
apps/deploy-web/src/components/authorizations/Authorizations.tsx(3 hunks)apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.spec.tsx(2 hunks)apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.tsx(3 hunks)apps/deploy-web/src/components/deployments/DeploymentList.tsx(1 hunks)apps/deploy-web/src/components/home/YourAccount.tsx(3 hunks)apps/deploy-web/src/components/layout/Layout.tsx(3 hunks)apps/deploy-web/src/components/layout/Sidebar.tsx(3 hunks)apps/deploy-web/src/components/layout/TopBanner.tsx(1 hunks)apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx(3 hunks)apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.tsx(7 hunks)apps/deploy-web/src/components/new-deployment/ManifestEdit.tsx(1 hunks)apps/deploy-web/src/components/settings/SettingsContainer.tsx(3 hunks)apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.spec.tsx(1 hunks)apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.tsx(2 hunks)apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx(2 hunks)packages/ui/components/button.tsx(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (7)
- apps/deploy-web/src/components/deployments/DeploymentList.tsx
- apps/deploy-web/src/components/home/YourAccount.tsx
- apps/deploy-web/src/components/layout/TopBanner.tsx
- apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx
- apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.tsx
- apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.spec.tsx
- apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.spec.tsx
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
Never use type any or cast to type any. Always define the proper TypeScript types.
Files:
apps/deploy-web/src/components/new-deployment/ManifestEdit.tsxpackages/ui/components/button.tsxapps/deploy-web/src/components/layout/Sidebar.tsxapps/deploy-web/src/components/settings/SettingsContainer.tsxapps/deploy-web/src/components/layout/Layout.tsxapps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.tsxapps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.tsxapps/deploy-web/src/components/authorizations/Authorizations.tsxapps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx
**/*.{js,ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
**/*.{js,ts,tsx}: Never use deprecated methods from libraries.
Don't add unnecessary comments to the code
Files:
apps/deploy-web/src/components/new-deployment/ManifestEdit.tsxpackages/ui/components/button.tsxapps/deploy-web/src/components/layout/Sidebar.tsxapps/deploy-web/src/components/settings/SettingsContainer.tsxapps/deploy-web/src/components/layout/Layout.tsxapps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.tsxapps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.tsxapps/deploy-web/src/components/authorizations/Authorizations.tsxapps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx
**/*.spec.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/no-jest-mock.mdc)
Don't use
jest.mock()to mock dependencies in test files. Instead, usejest-mock-extendedto create mocks and pass mocks as dependencies to the service under test.
**/*.spec.{ts,tsx}: Usesetupfunction instead ofbeforeEachin test files
setupfunction must be at the bottom of the rootdescribeblock in test files
setupfunction creates an object under test and returns it
setupfunction should accept a single parameter with inline type definition
Don't use shared state insetupfunction
Don't specify return type ofsetupfunction
Files:
apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx
apps/{deploy-web,provider-console}/**/*.spec.tsx
📄 CodeRabbit inference engine (.cursor/rules/query-by-in-tests.mdc)
Use
queryBymethods instead ofgetBymethods in test expectations in.spec.tsxfiles
Files:
apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx
🧠 Learnings (2)
📚 Learning: 2025-07-11T10:46:43.711Z
Learnt from: stalniy
PR: akash-network/console#1660
File: apps/deploy-web/src/components/alerts/DeploymentAlertsContainer/DeploymentAlertsContainer.spec.tsx:54-56
Timestamp: 2025-07-11T10:46:43.711Z
Learning: In apps/{deploy-web,provider-console}/**/*.spec.tsx files: Use `getBy` methods instead of `queryBy` methods when testing element presence with `toBeInTheDocument()` because `getBy` throws an error and shows DOM state when element is not found, providing better debugging information than `queryBy` which returns null.
Applied to files:
apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx
📚 Learning: 2025-07-21T08:24:27.953Z
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/query-by-in-tests.mdc:0-0
Timestamp: 2025-07-21T08:24:27.953Z
Learning: Applies to apps/{deploy-web,provider-console}/**/*.spec.tsx : Use `queryBy` methods instead of `getBy` methods in test expectations in `.spec.tsx` files
Applied to files:
apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx
🧬 Code graph analysis (6)
apps/deploy-web/src/components/layout/Sidebar.tsx (1)
apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx (1)
useSettings(303-305)
apps/deploy-web/src/components/settings/SettingsContainer.tsx (3)
apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx (1)
useSettings(303-305)apps/deploy-web/src/components/shared/Fieldset.tsx (1)
Fieldset(12-23)apps/deploy-web/src/components/settings/CertificateList.tsx (1)
CertificateList(12-114)
apps/deploy-web/src/components/layout/Layout.tsx (3)
apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx (1)
useSettings(303-305)apps/deploy-web/src/hooks/useHasCreditCardBanner.ts (1)
useHasCreditCardBanner(11-35)apps/deploy-web/src/components/layout/TopBanner.tsx (1)
NetworkDownBanner(21-27)
apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.tsx (2)
apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.tsx (1)
DEPENDENCIES(66-104)apps/deploy-web/src/context/CertificateProvider/CertificateProviderContext.tsx (1)
DEPENDENCIES(63-68)
apps/deploy-web/src/components/authorizations/Authorizations.tsx (3)
apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx (1)
useSettings(303-305)apps/deploy-web/src/components/settings/SettingsLayout.tsx (1)
SettingsLayout(24-58)apps/deploy-web/src/components/shared/Fieldset.tsx (1)
Fieldset(12-23)
apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx (2)
apps/deploy-web/src/components/new-deployment/BidGroup.tsx (1)
BidGroup(32-160)apps/deploy-web/tests/seeders/bid.ts (1)
buildRpcBid(7-81)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
- GitHub Check: validate / validate-app
- GitHub Check: test-build
- GitHub Check: test-build
- GitHub Check: test-build
- GitHub Check: Validate local packages
🔇 Additional comments (12)
packages/ui/components/button.tsx (1)
9-9: Good coverage foraria-disabledstyling.Nice touch adding the
aria-[disabled='true']fallbacks so ourasChildusage (e.g., links) visually and functionally mirrors the nativedisabledstate.apps/deploy-web/src/components/new-deployment/ManifestEdit.tsx (1)
354-354: Create Deployment correctly disabled when blockchain is downAdded
settings.isBlockchainDownto the disabled condition. Matches PR objective and prevents chain tx initiation from this entrypoint.apps/deploy-web/src/components/settings/SettingsContainer.tsx (1)
73-77: Hide Certificates section when blockchain is down — aligns with requirementsConditionally omitting the Certificates fieldset matches the “Hide certificates list” objective.
apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx (2)
490-506: Mocked useSettings shape looks correctThe injected
useSettingsreturns the expected structure and propagatesisBlockchainDowninto the SUT cleanly.
151-179: Test doesn’t isolate blockchain-down gating and violates queryBy guidelineThis asserts disabled state without selecting a bid; button is disabled anyway when no bid is selected. Also use queryBy* per repo rules for apps/deploy-web .spec.tsx.
Mirror the earlier suggestion to select a bid via the mocked BidGroup and assert with queryBy + toBeDisabled().
As per coding guidelines
apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.tsx (1)
44-49: Create Certificate button is correctly disabled when blockchain is downGating on
settings.isBlockchainDownalongsideisCreatingCertis correct and consistent with the PR.apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.tsx (1)
415-417: Close Deployment correctly disabled when offlineDropdown action, closed‑state button, and trial card action all respect
isBlockchainDown. Good.Also applies to: 450-452, 602-609
apps/deploy-web/src/components/authorizations/Authorizations.tsx (4)
212-219: Offline view should also stop queries and loading overlayUI hides lists when offline, but hooks still run and
Layoutmay show a spinner. Gate queries withenabled: !settings.isBlockchainDownand computeisLoadingas!settings.isBlockchainDown && .... Also short‑circuit submit handlers if offline.
243-245: Copy fix: “allow you to authorize”Insert missing “to”.
- These authorizations allow you authorize other addresses to spend on deployments or deployment deposits using your funds. You can revoke these + These authorizations allow you to authorize other addresses to spend on deployments or deployment deposits using your funds. You can revoke these
354-356: Copy fix: “allow you to authorize”Mirror the earlier grammar correction.
- These authorizations allow you authorize other addresses to spend on transaction fees using your funds. You can revoke these authorizations at + These authorizations allow you to authorize other addresses to spend on transaction fees using your funds. You can revoke these authorizations at
458-460: Copy fix: clarify sentenceImprove clarity and grammar.
- Deleting allowance to will revoke their ability to fees on your behalf. + Deleting this allowance will revoke their ability to pay fees on your behalf.apps/deploy-web/src/components/layout/Layout.tsx (1)
74-74: Avoid stacked, overlapping banners; show NetworkDownBanner exclusivelyWhen the network is down, hide the credit-card banner to prevent overlapping at top:0 and layout glitches.
Apply:
- const hasBanner = hasCreditCardBanner || isMaintenanceBannerOpen || settings.isBlockchainDown; + const hasBanner = (!settings.isBlockchainDown && hasCreditCardBanner) || isMaintenanceBannerOpen || settings.isBlockchainDown;- {hasCreditCardBanner && <CreditCardBanner />} - {settings.isBlockchainDown && ( - <> - <NetworkDownBanner /> - </> - )} + {!settings.isBlockchainDown && hasCreditCardBanner && <CreditCardBanner />} + {settings.isBlockchainDown && <NetworkDownBanner />}Also applies to: 100-107
apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.tsx
Outdated
Show resolved
Hide resolved
0b12f30 to
45348c9
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (3)
apps/deploy-web/src/components/authorizations/Authorizations.tsx (2)
69-80: Block offline fetches and stop the spinner when the chain is downQueries are still firing while
settings.isBlockchainDownis true, which will keep hammering the indexer/chain and surface avoidable errors/spinners in offline mode. We need to gate them and also avoid showing the global loader when the network is known down.
Apply something like:-const { data: granterGrants, isLoading: isLoadingGranterGrants } = useGranterGrants(address, pageIndex.deployment, pageSize.deployment, { - refetchInterval: isRefreshing === "granterGrants" ? refreshingInterval : defaultRefetchInterval, - select: selectNonMasterGrants, - enabled: !debouncedSearchGrantee -}); +const { data: granterGrants, isLoading: isLoadingGranterGrants } = useGranterGrants(address, pageIndex.deployment, pageSize.deployment, { + refetchInterval: isRefreshing === "granterGrants" ? refreshingInterval : defaultRefetchInterval, + select: selectNonMasterGrants, + enabled: !settings.isBlockchainDown && !debouncedSearchGrantee +}); const { data: granteeGrants, isLoading: isLoadingGranteeGrants } = useGranteeGrants(address, { refetchInterval: isRefreshing === "granteeGrants" ? refreshingInterval : defaultRefetchInterval + enabled: !settings.isBlockchainDown }); const { data: allowancesIssued, isLoading: isLoadingAllowancesIssued } = useAllowancesIssued(address, pageIndex.fee, pageSize.fee, { refetchInterval: isRefreshing === "allowancesIssued" ? refreshingInterval : defaultRefetchInterval, - select: selectNonMasterAllowances + select: selectNonMasterAllowances, + enabled: !settings.isBlockchainDown }); +const computedIsLoading = !settings.isBlockchainDown && isLoading; … - return ( - <Layout isLoading={isLoading}> + return ( + <Layout isLoading={computedIsLoading}>Please make the same adjustment for any other hooks in this component (and elsewhere if applicable) so we don’t trigger requests or overlays in offline mode.
Also applies to: 90-97, 209-213
119-143: No-op destructive actions once we detect offlineIf
settings.isBlockchainDownflips true after the modal opens, these handlers will continue to broadcast revoke transactions. Add an early return so we never sign/broadcast while offline:async function onDeleteGrantsConfirmed() { - if (!deletingGrants) return; + if (!deletingGrants || settings.isBlockchainDown) return; … async function onDeleteAllowanceConfirmed() { - if (!deletingAllowances) return; + if (!deletingAllowances || settings.isBlockchainDown) return;Same pattern should be applied to other submit flows in this component.
apps/deploy-web/src/hooks/useHasCreditCardBanner.ts (1)
13-33: Credit card banner keeps showing after the user no longer qualifies
isBannerVisibleonly ever flips totrue. Once the user satisfies the credit-card requirements (managed wallet/trial),shouldShowBannerturnsfalse, yet the effect never resetsisBannerVisible, soTopBannerkeeps rendering the credit-card banner indefinitely. Please recompute the visible state fromshouldShowBannerso it closes when the prerequisites are met.useEffect(() => { - if (shouldShowBanner) { - setIsBannerVisible(true); - } + setIsBannerVisible(shouldShowBanner); }, [shouldShowBanner]);
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (18)
apps/deploy-web/src/components/authorizations/Authorizations.tsx(3 hunks)apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.spec.tsx(2 hunks)apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.tsx(3 hunks)apps/deploy-web/src/components/deployments/DeploymentList.tsx(1 hunks)apps/deploy-web/src/components/home/YourAccount.tsx(3 hunks)apps/deploy-web/src/components/layout/Layout.tsx(4 hunks)apps/deploy-web/src/components/layout/Sidebar.tsx(3 hunks)apps/deploy-web/src/components/layout/TopBanner.tsx(3 hunks)apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx(3 hunks)apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.tsx(7 hunks)apps/deploy-web/src/components/new-deployment/ManifestEdit.tsx(1 hunks)apps/deploy-web/src/components/settings/SettingsContainer.tsx(3 hunks)apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.spec.tsx(1 hunks)apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.tsx(2 hunks)apps/deploy-web/src/context/TopBannerProvider/TopBannerProvider.tsx(1 hunks)apps/deploy-web/src/context/TopBannerProvider/index.ts(1 hunks)apps/deploy-web/src/hooks/useHasCreditCardBanner.ts(1 hunks)packages/ui/components/button.tsx(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- apps/deploy-web/src/context/TopBannerProvider/index.ts
🚧 Files skipped from review as they are similar to previous changes (8)
- apps/deploy-web/src/components/deployments/DeploymentList.tsx
- apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.spec.tsx
- apps/deploy-web/src/components/home/YourAccount.tsx
- apps/deploy-web/src/components/layout/TopBanner.tsx
- apps/deploy-web/src/components/new-deployment/ManifestEdit.tsx
- apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.tsx
- apps/deploy-web/src/components/settings/SettingsContainer.tsx
- apps/deploy-web/src/components/layout/Sidebar.tsx
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
Never use type any or cast to type any. Always define the proper TypeScript types.
Files:
packages/ui/components/button.tsxapps/deploy-web/src/hooks/useHasCreditCardBanner.tsapps/deploy-web/src/context/TopBannerProvider/TopBannerProvider.tsxapps/deploy-web/src/components/wallet/ConnectManagedWalletButton.tsxapps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.spec.tsxapps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.tsxapps/deploy-web/src/components/authorizations/Authorizations.tsxapps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsxapps/deploy-web/src/components/layout/Layout.tsx
**/*.{js,ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
**/*.{js,ts,tsx}: Never use deprecated methods from libraries.
Don't add unnecessary comments to the code
Files:
packages/ui/components/button.tsxapps/deploy-web/src/hooks/useHasCreditCardBanner.tsapps/deploy-web/src/context/TopBannerProvider/TopBannerProvider.tsxapps/deploy-web/src/components/wallet/ConnectManagedWalletButton.tsxapps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.spec.tsxapps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.tsxapps/deploy-web/src/components/authorizations/Authorizations.tsxapps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsxapps/deploy-web/src/components/layout/Layout.tsx
**/*.spec.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/no-jest-mock.mdc)
Don't use
jest.mock()to mock dependencies in test files. Instead, usejest-mock-extendedto create mocks and pass mocks as dependencies to the service under test.
**/*.spec.{ts,tsx}: Usesetupfunction instead ofbeforeEachin test files
setupfunction must be at the bottom of the rootdescribeblock in test files
setupfunction creates an object under test and returns it
setupfunction should accept a single parameter with inline type definition
Don't use shared state insetupfunction
Don't specify return type ofsetupfunction
Files:
apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.spec.tsxapps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx
apps/{deploy-web,provider-console}/**/*.spec.tsx
📄 CodeRabbit inference engine (.cursor/rules/query-by-in-tests.mdc)
Use
queryBymethods instead ofgetBymethods in test expectations in.spec.tsxfiles
Files:
apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.spec.tsxapps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx
🧠 Learnings (5)
📓 Common learnings
Learnt from: stalniy
PR: akash-network/console#1971
File: apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.tsx:47-48
Timestamp: 2025-09-29T03:55:35.883Z
Learning: In the Akash Network Console project, when blockchain is down (settings.isBlockchainDown), disabling buttons like "Start Trial" is acceptable instead of completely hiding them.
📚 Learning: 2025-09-29T03:58:26.404Z
Learnt from: stalniy
PR: akash-network/console#1971
File: apps/deploy-web/src/components/home/YourAccount.tsx:234-239
Timestamp: 2025-09-29T03:58:26.404Z
Learning: In the Akash Network Console project, the UI components use CSS approach for disabling elements with aria-disabled="true" using "aria-[disabled='true']:pointer-events-none aria-[disabled='true']:opacity-50" classes, as seen in the button component. This pattern should be extended to links for consistency.
Applied to files:
packages/ui/components/button.tsx
📚 Learning: 2025-09-29T03:55:35.883Z
Learnt from: stalniy
PR: akash-network/console#1971
File: apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.tsx:47-48
Timestamp: 2025-09-29T03:55:35.883Z
Learning: In the Akash Network Console project, when blockchain is down (settings.isBlockchainDown), disabling buttons like "Start Trial" is acceptable instead of completely hiding them.
Applied to files:
apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.tsxapps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.tsxapps/deploy-web/src/components/authorizations/Authorizations.tsxapps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx
📚 Learning: 2025-07-21T08:24:27.953Z
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/query-by-in-tests.mdc:0-0
Timestamp: 2025-07-21T08:24:27.953Z
Learning: Applies to apps/{deploy-web,provider-console}/**/*.spec.tsx : Use `queryBy` methods instead of `getBy` methods in test expectations in `.spec.tsx` files
Applied to files:
apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx
📚 Learning: 2025-07-11T10:46:43.711Z
Learnt from: stalniy
PR: akash-network/console#1660
File: apps/deploy-web/src/components/alerts/DeploymentAlertsContainer/DeploymentAlertsContainer.spec.tsx:54-56
Timestamp: 2025-07-11T10:46:43.711Z
Learning: In apps/{deploy-web,provider-console}/**/*.spec.tsx files: Use `getBy` methods instead of `queryBy` methods when testing element presence with `toBeInTheDocument()` because `getBy` throws an error and shows DOM state when element is not found, providing better debugging information than `queryBy` which returns null.
Applied to files:
apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx
🧬 Code graph analysis (6)
apps/deploy-web/src/hooks/useHasCreditCardBanner.ts (2)
apps/deploy-web/src/hooks/useUser.ts (1)
useUser(7-20)apps/deploy-web/src/context/WalletProvider/WalletProvider.tsx (1)
useWallet(355-357)
apps/deploy-web/src/context/TopBannerProvider/TopBannerProvider.tsx (4)
apps/deploy-web/src/context/TopBannerProvider/index.ts (1)
TopBannerProvider(1-1)apps/deploy-web/src/types/component.ts (1)
FCWithChildren(4-4)apps/deploy-web/src/hooks/useVariant.tsx (1)
useVariant(12-12)apps/deploy-web/src/hooks/useHasCreditCardBanner.ts (1)
useHasCreditCardBanner(11-35)
apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.tsx (5)
apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.tsx (2)
DEPENDENCIES(66-104)Props(61-64)apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.tsx (2)
DEPENDENCIES(10-16)Props(18-22)apps/deploy-web/src/context/CertificateProvider/CertificateProviderContext.tsx (1)
DEPENDENCIES(63-68)packages/ui/components/button.tsx (1)
ButtonProps(36-38)apps/deploy-web/src/context/WalletProvider/WalletProvider.tsx (1)
useWallet(355-357)
apps/deploy-web/src/components/authorizations/Authorizations.tsx (2)
apps/deploy-web/src/components/settings/SettingsLayout.tsx (1)
SettingsLayout(24-58)apps/deploy-web/src/components/shared/Fieldset.tsx (1)
Fieldset(12-23)
apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx (2)
apps/deploy-web/src/components/new-deployment/BidGroup.tsx (1)
BidGroup(32-160)apps/deploy-web/tests/seeders/bid.ts (1)
buildRpcBid(7-81)
apps/deploy-web/src/components/layout/Layout.tsx (2)
apps/deploy-web/src/context/TopBannerProvider/TopBannerProvider.tsx (2)
TopBannerProvider(18-39)useTopBanner(41-41)apps/deploy-web/src/components/layout/TopBanner.tsx (1)
TopBanner(49-65)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
- GitHub Check: test-build
- GitHub Check: validate / validate-app
- GitHub Check: test-build
- GitHub Check: test-build
- GitHub Check: Validate local packages
🔇 Additional comments (7)
packages/ui/components/button.tsx (1)
9-9: Consistent aria-disabled stylingNice touch adding the
aria-[disabled='true']variants so Slot-based buttons and links inherit the same disabled affordances—this keeps our accessibility pattern uniform. Based on learningsapps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.spec.tsx (1)
58-73: Nice alignment with the updateduseSettingscontract.Wiring
isBlockchainDowninto the stubbed settings object keeps the test harness in sync with the component’s new gating logic without altering existing call sites. Good call spreading the base dependencies so only the override is customized.apps/deploy-web/src/components/authorizations/Authorizations.tsx (3)
242-245: Fix copy: “allow you authorize” → “allow you to authorize”Grammar issue persists here; please insert the missing “to” so the sentence reads correctly.
353-356: Fix copy: “allow you authorize” → “allow you to authorize”Same grammar fix needed in the fee authorizations section.
448-459: Fix copy: “Deleting allowance to will…”The confirmation text is still broken English. Update it to something like “Deleting this allowance will revoke their ability to pay fees on your behalf.”
apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.tsx (1)
27-32: Dependency injection keeps the button testable.Threading
useFlag,useRouter, anduseSettingsthrough thedependenciesprop lets us stub them in stories/tests while defaulting to the real hooks in production. Nice quality-of-life improvement.apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx (1)
151-178: Fix test to assert blockchain gating correctlyThe Accept Bid button here is already disabled because no bid is selected, so the test still passes even when
isBlockchainDownis false. Please select a bid via the mockedBidGroupbefore asserting, and switch the expectation toqueryByRoleper the spec guidelines so you actually verify the offline gate.Apply this diff:
- const { getByRole } = setup({ + setup({ BidGroup, bids, isBlockchainDown: true }); - await waitFor(() => { - expect(getByRole("button", { name: /Accept Bid/i })).toHaveAttribute("disabled"); - }); + await waitFor(() => expect(BidGroup).toHaveBeenCalled()); + const bidGroupProps = (BidGroup as jest.Mock).mock.calls[0][0]; + act(() => { + bidGroupProps.handleBidSelected(mapToBidDto(bids[0])); + }); + await waitFor(() => { + expect(screen.queryByRole("button", { name: /Accept Bid/i })).toBeDisabled(); + });As per coding guidelines
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (8)
apps/deploy-web/src/queries/useGrantsQuery.ts (5)
18-28: Avoid mutating the incoming options object; compute a local enabledDirectly assigning to options.enabled can introduce subtle side effects if callers reuse the same object. Compute a local enabled and pass it to useQuery so intent is explicit and side‑effect free.
Apply:
- options.enabled = options.enabled !== false && !!address && !!authzHttpService.defaults.baseURL && !settings.isBlockchainDown; + const enabled = + (options.enabled !== false) && + !!address && + !!authzHttpService.defaults.baseURL && + !settings.isBlockchainDown; @@ - ...options + ...options, + enabled
32-41: Same here: don’t mutate options; pass a computed enabledRepeat the no‑mutation pattern for this hook as well.
- options.enabled = options.enabled !== false && !!address && !!authzHttpService.defaults.baseURL && !settings.isBlockchainDown; + const enabled = + (options.enabled !== false) && + !!address && + !!authzHttpService.defaults.baseURL && + !settings.isBlockchainDown; @@ - ...options + ...options, + enabled
50-61: Same pattern: compute enabled locallyKeeps behavior identical while avoiding mutation.
- options.enabled = options.enabled !== false && !!address && !!authzHttpService.defaults.baseURL && !settings.isBlockchainDown; + const enabled = + (options.enabled !== false) && + !!address && + !!authzHttpService.defaults.baseURL && + !settings.isBlockchainDown; @@ - ...options + ...options, + enabled
68-78: Same pattern for allowancesGrantedCompute and pass enabled; don’t modify the caller’s object.
- options.enabled = options.enabled !== false && !!address && !!chainApiHttpClient.defaults.baseURL && !settings.isBlockchainDown; + const enabled = + (options.enabled !== false) && + !!address && + !!chainApiHttpClient.defaults.baseURL && + !settings.isBlockchainDown; @@ - ...options + ...options, + enabled
7-7: UnifyuseSettingsimport to barrel
Inapps/deploy-web/src/queries/useGrantsQuery.ts, importuseSettingsfrom"@src/context/SettingsProvider"instead of"@src/context/SettingsProvider/SettingsProviderContext"to match the rest of the codebase.apps/deploy-web/src/context/TopBannerProvider/TopBannerProvider.tsx (3)
32-41: Memoize provider value to reduce unnecessary consumer re‑rendersCreating a new object each render forces all consumers to re‑render even when fields don’t change. Wrap value in useMemo.
- const value = { - hasBanner, - isMaintenanceBannerOpen, - setIsMaintenanceBannerOpen, - isBlockchainDown: settings.isBlockchainDown, - hasCreditCardBanner - }; + const value = React.useMemo( + () => ({ + hasBanner, + isMaintenanceBannerOpen, + setIsMaintenanceBannerOpen, + isBlockchainDown: settings.isBlockchainDown, + hasCreditCardBanner + }), + [hasBanner, isMaintenanceBannerOpen, settings.isBlockchainDown, hasCreditCardBanner] + );
43-43: Return the context value directly to preserve referential identitySpreading creates a new object on each call, defeating memoization and triggering effects that depend on the hook result. Return the context value as‑is.
-export const useTopBanner = () => ({ ...React.useContext(TopBannerContext) }); +export const useTopBanner = () => React.useContext(TopBannerContext);
21-21: Use the barrel export foruseSettings
All imports ofuseSettingsshould come from theSettingsProviderindex (e.g.@src/context/SettingsProvideror relative../SettingsProvider), not directly fromSettingsProviderContext. Update any deep imports (e.g.…/SettingsProvider/SettingsProviderContext) to the barrel path for consistency.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
apps/deploy-web/src/context/TopBannerProvider/TopBannerProvider.tsx(1 hunks)apps/deploy-web/src/queries/useGrantsQuery.ts(5 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
Never use type any or cast to type any. Always define the proper TypeScript types.
Files:
apps/deploy-web/src/context/TopBannerProvider/TopBannerProvider.tsxapps/deploy-web/src/queries/useGrantsQuery.ts
**/*.{js,ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
**/*.{js,ts,tsx}: Never use deprecated methods from libraries.
Don't add unnecessary comments to the code
Files:
apps/deploy-web/src/context/TopBannerProvider/TopBannerProvider.tsxapps/deploy-web/src/queries/useGrantsQuery.ts
🧠 Learnings (1)
📓 Common learnings
Learnt from: stalniy
PR: akash-network/console#1971
File: apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.tsx:47-48
Timestamp: 2025-09-29T03:55:35.883Z
Learning: In the Akash Network Console project, when blockchain is down (settings.isBlockchainDown), disabling buttons like "Start Trial" is acceptable instead of completely hiding them.
🧬 Code graph analysis (2)
apps/deploy-web/src/context/TopBannerProvider/TopBannerProvider.tsx (3)
apps/deploy-web/src/types/component.ts (1)
FCWithChildren(4-4)apps/deploy-web/src/hooks/useVariant.tsx (1)
useVariant(12-12)apps/deploy-web/src/hooks/useHasCreditCardBanner.ts (1)
useHasCreditCardBanner(11-35)
apps/deploy-web/src/queries/useGrantsQuery.ts (2)
apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx (1)
useSettings(333-335)apps/deploy-web/src/context/ServicesProvider/ServicesProvider.tsx (1)
useServices(28-30)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
- GitHub Check: validate / validate-app
- GitHub Check: test-build
- GitHub Check: test-build
- GitHub Check: test-build
- GitHub Check: Validate local packages
🔇 Additional comments (1)
apps/deploy-web/src/context/TopBannerProvider/TopBannerProvider.tsx (1)
24-26: Nice: maintenance banner now auto‑opens when the flag resolves trueSwitching to a reactive open via useWhen addresses the prior “never opens after hydration” issue flagged earlier.
9f8f8b4 to
7c948aa
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
apps/deploy-web/src/queries/useGrantsQuery.spec.tsx (2)
178-187: Avoidas anyin Axios mocksThe cast to
anyviolates our TS guideline. Use a deep mock and a typed AxiosResponse instead.Apply this diff:
-import type { AxiosInstance } from "axios"; -import { mock } from "jest-mock-extended"; +import type { AxiosInstance, AxiosRequestConfig, AxiosResponse } from "axios"; +import { mock, mockDeep } from "jest-mock-extended"; @@ - const chainApiHttpClient = mock<AxiosInstance>({ - defaults: { baseURL: "https://api.akash.network" }, - get: jest.fn().mockResolvedValue({ - data: { - allowances: mockData, - pagination: { next_key: null, total: mockData.length } - } - }) - } as any); + const chainApiHttpClient = mockDeep<AxiosInstance>(); + chainApiHttpClient.defaults.baseURL = "https://api.akash.network"; + const axiosResponse: AxiosResponse<{ + allowances: typeof mockData; + pagination: { next_key: null; total: number }; + }> = { + data: { + allowances: mockData, + pagination: { next_key: null, total: mockData.length } + }, + status: 200, + statusText: "OK", + headers: {}, + // minimal config to satisfy type; no runtime impact in tests + config: {} as AxiosRequestConfig + }; + chainApiHttpClient.get.mockResolvedValue(axiosResponse);
1-222: Remove allas anycasts in spec files
The scan uncoveredas anyin:
apps/deploy-web/src/queries/useLeaseQuery.spec.tsx(line 223)apps/deploy-web/src/queries/useGrantsQuery.spec.tsx(lines 186, 213)apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx(line 140)apps/deploy-web/src/queries/useAnonymousUserQuery/useAnonymousUserQuery.spec.tsx(lines 82, 111, 251)Replace each cast with explicit TypeScript types or properly typed mocks per repo conventions.
🧹 Nitpick comments (2)
apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx (1)
294-312: Double‑check “down” criteria doesn’t ignore catching_upisBlockchainDown flips only on status === "inactive". If nodes are “active” but still catching_up, UI will not enter offline mode. Confirm product intent; if catching_up should also gate writes, include
nodeInfo?.sync_info.catching_upin the predicate.apps/deploy-web/src/queries/useGrantsQuery.spec.tsx (1)
13-29: Minor: allow overridingisBlockchainDownin mocksConsider parameterizing
createMockSettingsContextto overridesettings.isBlockchainDownper test without re‑declaring the provider.Example:
-const createMockSettingsContext = (): SettingsContextType => +const createMockSettingsContext = (overrides?: Partial<SettingsContextType>): SettingsContextType => mock({ settings: { apiEndpoint: "https://api.example.com", rpcEndpoint: "https://rpc.example.com", isCustomNode: false, nodes: [], selectedNode: null, customNode: null, - isBlockchainDown: false + isBlockchainDown: false }, setSettings: jest.fn(), isLoadingSettings: false, isSettingsInit: true, refreshNodeStatuses: jest.fn(), isRefreshingNodeStatus: false - }); + }, overrides);
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx(1 hunks)apps/deploy-web/src/queries/useGrantsQuery.spec.tsx(9 hunks)apps/deploy-web/src/queries/useGrantsQuery.ts(5 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- apps/deploy-web/src/queries/useGrantsQuery.ts
🧰 Additional context used
📓 Path-based instructions (4)
**/*.spec.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/no-jest-mock.mdc)
Don't use
jest.mock()to mock dependencies in test files. Instead, usejest-mock-extendedto create mocks and pass mocks as dependencies to the service under test.
**/*.spec.{ts,tsx}: Usesetupfunction instead ofbeforeEachin test files
setupfunction must be at the bottom of the rootdescribeblock in test files
setupfunction creates an object under test and returns it
setupfunction should accept a single parameter with inline type definition
Don't use shared state insetupfunction
Don't specify return type ofsetupfunction
Files:
apps/deploy-web/src/queries/useGrantsQuery.spec.tsx
apps/{deploy-web,provider-console}/**/*.spec.tsx
📄 CodeRabbit inference engine (.cursor/rules/query-by-in-tests.mdc)
Use
queryBymethods instead ofgetBymethods in test expectations in.spec.tsxfiles
Files:
apps/deploy-web/src/queries/useGrantsQuery.spec.tsx
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
Never use type any or cast to type any. Always define the proper TypeScript types.
Files:
apps/deploy-web/src/queries/useGrantsQuery.spec.tsxapps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx
**/*.{js,ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
**/*.{js,ts,tsx}: Never use deprecated methods from libraries.
Don't add unnecessary comments to the code
Files:
apps/deploy-web/src/queries/useGrantsQuery.spec.tsxapps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx
🧠 Learnings (2)
📓 Common learnings
Learnt from: stalniy
PR: akash-network/console#1971
File: apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.tsx:47-48
Timestamp: 2025-09-29T03:55:35.883Z
Learning: In the Akash Network Console project, when blockchain is down (settings.isBlockchainDown), disabling buttons like "Start Trial" is acceptable instead of completely hiding them.
📚 Learning: 2025-07-21T08:24:27.953Z
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/query-by-in-tests.mdc:0-0
Timestamp: 2025-07-21T08:24:27.953Z
Learning: Applies to apps/{deploy-web,provider-console}/**/*.spec.tsx : Use `queryBy` methods instead of `getBy` methods in test expectations in `.spec.tsx` files
Applied to files:
apps/deploy-web/src/queries/useGrantsQuery.spec.tsx
🧬 Code graph analysis (2)
apps/deploy-web/src/queries/useGrantsQuery.spec.tsx (3)
apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx (2)
SettingsContextType(41-41)SettingsProviderContext(43-43)apps/deploy-web/tests/unit/query-client.tsx (1)
setupQuery(9-30)apps/deploy-web/src/queries/useGrantsQuery.ts (1)
useAllowancesGranted(67-78)
apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx (2)
apps/deploy-web/src/context/WalletProvider/WalletProvider.tsx (1)
ContextType(42-59)apps/deploy-web/src/context/CertificateProvider/CertificateProviderContext.tsx (1)
ContextType(38-59)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
- GitHub Check: test-build
- GitHub Check: test-build
- GitHub Check: validate / validate-app
- GitHub Check: test-build
- GitHub Check: Validate local packages
🔇 Additional comments (3)
apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx (1)
43-43: Publicly exporting Settings context — LGTMMaking the context export public is appropriate for tests and custom providers. No behavioral regressions detected.
apps/deploy-web/src/queries/useGrantsQuery.spec.tsx (2)
31-35: Nice: local SettingsContext test wrapperThis wrapper keeps tests decoupled from the real provider and lets you toggle
isBlockchainDown. Solid approach.
1-12: Conformance: aligns with testing rules
- Uses jest-mock-extended.
- No
beforeEach.- No getBy queries in UI tests here.
All good.
5f94a68 to
0b052e2
Compare
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
apps/deploy-web/src/components/authorizations/Authorizations.tsx (1)
69-87: Gate queries with blockchain-down flag.The query hooks will fire even when the blockchain is down, potentially causing errors or unnecessary load. Add
enabled: !settings.isBlockchainDownto the query options to prevent them from executing in offline mode.Apply this diff to gate the queries:
const { data: granterGrants, isLoading: isLoadingGranterGrants } = useGranterGrants(address, pageIndex.deployment, pageSize.deployment, { refetchInterval: isRefreshing === "granterGrants" ? refreshingInterval : defaultRefetchInterval, select: selectNonMasterGrants, - enabled: !debouncedSearchGrantee + enabled: !settings.isBlockchainDown && !debouncedSearchGrantee }); const { data: granteeGrants, isLoading: isLoadingGranteeGrants } = useGranteeGrants(address, { - refetchInterval: isRefreshing === "granteeGrants" ? refreshingInterval : defaultRefetchInterval + refetchInterval: isRefreshing === "granteeGrants" ? refreshingInterval : defaultRefetchInterval, + enabled: !settings.isBlockchainDown }); const { data: allowancesIssued, isLoading: isLoadingAllowancesIssued } = useAllowancesIssued(address, pageIndex.fee, pageSize.fee, { refetchInterval: isRefreshing === "allowancesIssued" ? refreshingInterval : defaultRefetchInterval, - select: selectNonMasterAllowances + select: selectNonMasterAllowances, + enabled: !settings.isBlockchainDown });
♻️ Duplicate comments (2)
apps/deploy-web/src/components/authorizations/Authorizations.tsx (1)
458-459: Fix grammar in deletion confirmation.The popup text contains grammar errors: "Deleting allowance to will revoke their ability to fees on your behalf."
Apply this diff:
- Deleting allowance to will revoke their ability to fees on your behalf. + Deleting this allowance will revoke their ability to pay fees on your behalf.apps/deploy-web/src/components/deployments/DeploymentList.tsx (1)
226-235: Aria-disabled on Link doesn't prevent navigation; apply onClick guard and disabled styling.Setting
aria-disabledon an anchor doesn't stop navigation or theonClickhandler. The Link remains clickable when the blockchain is down. Based on learnings, you should prevent default navigation and add disabled styling.Apply this diff:
<Link href={UrlService.newDeployment()} - className={cn(buttonVariants({ variant: "default", size: "lg" }), "mt-4")} - onClick={onDeployClick} + className={cn( + buttonVariants({ variant: "default", size: "lg" }), + "mt-4", + "aria-[disabled='true']:pointer-events-none aria-[disabled='true']:opacity-50" + )} + onClick={e => { + if (settings.isBlockchainDown) { + e.preventDefault(); + return; + } + onDeployClick(); + }} aria-disabled={settings.isBlockchainDown} >Based on learnings.
🧹 Nitpick comments (4)
apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.tsx (1)
15-19: Consider including useWallet in DEPENDENCIES for consistency.While
useFlag,useRouter, anduseSettingsare now injected via theDEPENDENCIESbundle,useWalletis still imported and called directly (line 29). For consistency and testability, consider addinguseWalletto theDEPENDENCIESobject so all hooks can be mocked uniformly in tests.Apply this diff:
const DEPENDENCIES = { useFlag, useRouter, - useSettings + useSettings, + useWallet };And update the component to use it:
- const { connectManagedWallet, hasManagedWallet, isWalletLoading } = useWallet(); + const { connectManagedWallet, hasManagedWallet, isWalletLoading } = d.useWallet();apps/deploy-web/src/components/authorizations/Authorizations.tsx (2)
209-209: Prevent loading overlay when blockchain is down.The
isLoadingflag should be gated to prevent showing a spinner when the blockchain is offline.Apply this diff:
+const computedIsLoading = !settings.isBlockchainDown && isLoading; + return ( - <Layout isLoading={isLoading}> + <Layout isLoading={computedIsLoading}> <NextSeo title="Settings Authorizations" />
119-143: Add defensive guards for blockchain-down state.Although the UI is hidden when the blockchain is down, add defensive guards to the transaction handlers in case the blockchain state changes during an operation.
Apply this diff:
async function onDeleteGrantsConfirmed() { + if (settings.isBlockchainDown) return; if (!deletingGrants) return; const messages = deletingGrants.map(grant => TransactionMessageData.getRevokeMsg(address, grant.grantee, grant.authorization["@type"])); const response = await signAndBroadcastTx(messages); if (response) { setIsRefreshing("granterGrants"); setDeletingGrants(null); setSelectedGrants([]); } } async function onDeleteAllowanceConfirmed() { + if (settings.isBlockchainDown) return; if (!deletingAllowances) return; const messages = deletingAllowances.map(allowance => TransactionMessageData.getRevokeAllowanceMsg(address, allowance.grantee)); const response = await signAndBroadcastTx(messages); if (response) { setIsRefreshing("allowancesIssued"); setDeletingAllowances(null); setSelectedAllowances([]); } }apps/deploy-web/src/context/TopBannerProvider/TopBannerProvider.tsx (1)
43-43: Consider removing the spread operator for better dependency tracking.Spreading the context (
{...React.useContext(TopBannerContext)}) creates a new object on every call, breaking referential equality. If consumers later useconst banner = useTopBanner()in dependency arrays, effects will rerun unnecessarily. Current usage destructures immediately, avoiding this, but it's a maintainability risk.Consider returning the context directly:
-export const useTopBanner = () => ({ ...React.useContext(TopBannerContext) }); +export const useTopBanner = () => React.useContext(TopBannerContext);
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (21)
apps/deploy-web/src/components/authorizations/Authorizations.tsx(3 hunks)apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.spec.tsx(2 hunks)apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.tsx(3 hunks)apps/deploy-web/src/components/deployments/DeploymentList.tsx(1 hunks)apps/deploy-web/src/components/home/YourAccount.tsx(3 hunks)apps/deploy-web/src/components/layout/Layout.tsx(4 hunks)apps/deploy-web/src/components/layout/Sidebar.tsx(3 hunks)apps/deploy-web/src/components/layout/TopBanner.tsx(3 hunks)apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx(3 hunks)apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.tsx(7 hunks)apps/deploy-web/src/components/new-deployment/ManifestEdit.tsx(1 hunks)apps/deploy-web/src/components/settings/SettingsContainer.tsx(3 hunks)apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.spec.tsx(1 hunks)apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.tsx(2 hunks)apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx(1 hunks)apps/deploy-web/src/context/TopBannerProvider/TopBannerProvider.tsx(1 hunks)apps/deploy-web/src/context/TopBannerProvider/index.ts(1 hunks)apps/deploy-web/src/hooks/useHasCreditCardBanner.ts(1 hunks)apps/deploy-web/src/queries/useGrantsQuery.spec.tsx(9 hunks)apps/deploy-web/src/queries/useGrantsQuery.ts(5 hunks)packages/ui/components/button.tsx(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (11)
- apps/deploy-web/src/queries/useGrantsQuery.spec.tsx
- packages/ui/components/button.tsx
- apps/deploy-web/src/context/TopBannerProvider/index.ts
- apps/deploy-web/src/components/home/YourAccount.tsx
- apps/deploy-web/src/hooks/useHasCreditCardBanner.ts
- apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx
- apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.spec.tsx
- apps/deploy-web/src/components/layout/Sidebar.tsx
- apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.spec.tsx
- apps/deploy-web/src/components/new-deployment/ManifestEdit.tsx
- apps/deploy-web/src/components/settings/SettingsContainer.tsx
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
Never use type any or cast to type any. Always define the proper TypeScript types.
Files:
apps/deploy-web/src/components/layout/TopBanner.tsxapps/deploy-web/src/queries/useGrantsQuery.tsapps/deploy-web/src/components/layout/Layout.tsxapps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.tsxapps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.tsxapps/deploy-web/src/context/TopBannerProvider/TopBannerProvider.tsxapps/deploy-web/src/components/deployments/DeploymentList.tsxapps/deploy-web/src/components/wallet/ConnectManagedWalletButton.tsxapps/deploy-web/src/components/authorizations/Authorizations.tsxapps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx
**/*.{js,ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
**/*.{js,ts,tsx}: Never use deprecated methods from libraries.
Don't add unnecessary comments to the code
Files:
apps/deploy-web/src/components/layout/TopBanner.tsxapps/deploy-web/src/queries/useGrantsQuery.tsapps/deploy-web/src/components/layout/Layout.tsxapps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.tsxapps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.tsxapps/deploy-web/src/context/TopBannerProvider/TopBannerProvider.tsxapps/deploy-web/src/components/deployments/DeploymentList.tsxapps/deploy-web/src/components/wallet/ConnectManagedWalletButton.tsxapps/deploy-web/src/components/authorizations/Authorizations.tsxapps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx
**/*.spec.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/no-jest-mock.mdc)
Don't use
jest.mock()to mock dependencies in test files. Instead, usejest-mock-extendedto create mocks and pass mocks as dependencies to the service under test.
**/*.spec.{ts,tsx}: Usesetupfunction instead ofbeforeEachin test files
setupfunction must be at the bottom of the rootdescribeblock in test files
setupfunction creates an object under test and returns it
setupfunction should accept a single parameter with inline type definition
Don't use shared state insetupfunction
Don't specify return type ofsetupfunction
Files:
apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx
apps/{deploy-web,provider-console}/**/*.spec.tsx
📄 CodeRabbit inference engine (.cursor/rules/query-by-in-tests.mdc)
Use
queryBymethods instead ofgetBymethods in test expectations in.spec.tsxfiles
Files:
apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx
🧠 Learnings (3)
📓 Common learnings
Learnt from: stalniy
PR: akash-network/console#1971
File: apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.tsx:47-48
Timestamp: 2025-09-29T03:55:35.883Z
Learning: In the Akash Network Console project, when blockchain is down (settings.isBlockchainDown), disabling buttons like "Start Trial" is acceptable instead of completely hiding them.
📚 Learning: 2025-09-29T03:58:26.404Z
Learnt from: stalniy
PR: akash-network/console#1971
File: apps/deploy-web/src/components/home/YourAccount.tsx:234-239
Timestamp: 2025-09-29T03:58:26.404Z
Learning: In the Akash Network Console project, the UI components use CSS approach for disabling elements with aria-disabled="true" using "aria-[disabled='true']:pointer-events-none aria-[disabled='true']:opacity-50" classes, as seen in the button component. This pattern should be extended to links for consistency.
Applied to files:
apps/deploy-web/src/components/deployments/DeploymentList.tsx
📚 Learning: 2025-09-29T03:55:35.883Z
Learnt from: stalniy
PR: akash-network/console#1971
File: apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.tsx:47-48
Timestamp: 2025-09-29T03:55:35.883Z
Learning: In the Akash Network Console project, when blockchain is down (settings.isBlockchainDown), disabling buttons like "Start Trial" is acceptable instead of completely hiding them.
Applied to files:
apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.tsx
🧬 Code graph analysis (9)
apps/deploy-web/src/components/layout/TopBanner.tsx (2)
apps/deploy-web/src/context/TopBannerProvider/TopBannerProvider.tsx (1)
useTopBanner(43-43)apps/deploy-web/src/context/TopBannerProvider/index.ts (1)
useTopBanner(1-1)
apps/deploy-web/src/queries/useGrantsQuery.ts (2)
apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx (1)
useSettings(333-335)apps/deploy-web/src/context/ServicesProvider/ServicesProvider.tsx (1)
useServices(28-30)
apps/deploy-web/src/components/layout/Layout.tsx (2)
apps/deploy-web/src/context/TopBannerProvider/TopBannerProvider.tsx (2)
TopBannerProvider(19-41)useTopBanner(43-43)apps/deploy-web/src/components/layout/TopBanner.tsx (1)
TopBanner(49-65)
apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.tsx (2)
apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.tsx (1)
DEPENDENCIES(66-104)apps/deploy-web/src/context/CertificateProvider/CertificateProviderContext.tsx (1)
DEPENDENCIES(63-68)
apps/deploy-web/src/context/TopBannerProvider/TopBannerProvider.tsx (4)
apps/deploy-web/src/context/TopBannerProvider/index.ts (1)
TopBannerProvider(1-1)apps/deploy-web/src/types/component.ts (1)
FCWithChildren(4-4)apps/deploy-web/src/hooks/useVariant.tsx (1)
useVariant(12-12)apps/deploy-web/src/hooks/useHasCreditCardBanner.ts (1)
useHasCreditCardBanner(11-35)
apps/deploy-web/src/components/deployments/DeploymentList.tsx (3)
apps/deploy-web/src/utils/urlUtils.ts (1)
UrlService(16-81)apps/provider-console/src/utils/styleUtils.ts (1)
cn(4-6)packages/ui/components/button.tsx (1)
buttonVariants(46-46)
apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.tsx (4)
apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.tsx (2)
DEPENDENCIES(66-104)Props(61-64)apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.tsx (2)
DEPENDENCIES(10-16)Props(18-22)apps/deploy-web/src/context/CertificateProvider/CertificateProviderContext.tsx (1)
DEPENDENCIES(63-68)apps/deploy-web/src/context/WalletProvider/WalletProvider.tsx (1)
useWallet(355-357)
apps/deploy-web/src/components/authorizations/Authorizations.tsx (3)
apps/deploy-web/src/components/settings/SettingsLayout.tsx (1)
SettingsLayout(24-58)apps/deploy-web/src/components/shared/Fieldset.tsx (1)
Fieldset(12-23)packages/ui/components/custom/popup.tsx (1)
Popup(101-330)
apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx (3)
apps/deploy-web/src/components/new-deployment/BidGroup.tsx (1)
BidGroup(32-160)apps/deploy-web/tests/seeders/bid.ts (1)
buildRpcBid(7-81)apps/deploy-web/src/queries/useBidQuery.ts (1)
mapToBidDto(19-31)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
- GitHub Check: validate / validate-app
- GitHub Check: test-build
- GitHub Check: test-build
- GitHub Check: test-build
- GitHub Check: Validate local packages
🔇 Additional comments (18)
apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.tsx (3)
21-25: LGTM!The Props interface correctly extends ButtonProps and adds the optional
dependenciesprop typed from the DEPENDENCIES object, following the dependency injection pattern used across the codebase.
27-31: LGTM!The component signature correctly implements the dependency injection pattern with a default value, and hooks are properly called through the dependencies object. The destructuring of
settingsfromd.useSettings()is correct.
47-47: LGTM!The disabled logic correctly integrates
settings.isBlockchainDownto disable the button when the blockchain is down. This approach (disabling rather than hiding) is consistent with the project's design decision for this button.Based on learnings.
apps/deploy-web/src/components/authorizations/Authorizations.tsx (2)
10-10: LGTM: Settings integration.The
useSettingshook is correctly imported and used to access the blockchain-down state.Also applies to: 50-50
212-465: LGTM: Blockchain-down conditional structure.The two-branch layout correctly hides the authorizations UI when the blockchain is down and displays an informative notice to the user.
apps/deploy-web/src/queries/useGrantsQuery.ts (2)
7-7: LGTM! Consistent settings integration.The
useSettingsimport and hook calls follow the established pattern across the codebase.Also applies to: 18-18, 32-32, 50-50, 68-68
22-22: LGTM! Proper blockchain-down gating.All grant-related queries are correctly disabled when the blockchain is down, preventing unnecessary network calls.
Also applies to: 35-35, 54-54, 71-71
apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.tsx (2)
8-8: LGTM! Proper dependency injection setup.The
useSettingsimport and DEPENDENCIES map update enable testable blockchain-down gating.Also applies to: 14-16
25-25: LGTM! Certificate creation properly gated.The button correctly disables when blockchain is down, preventing certificate transactions during downtime. Based on learnings.
Also applies to: 47-47
apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.tsx (4)
34-34: LGTM! Proper settings integration.The
useSettingsimport and DEPENDENCIES update follow the established pattern.Also applies to: 102-104
115-115: LGTM!Settings properly destructured for use throughout the component.
415-417: LGTM! Close Deployment actions properly gated.All Close Deployment buttons correctly disable when blockchain is down, preventing transaction attempts during downtime.
Also applies to: 448-450, 600-609
428-428: LGTM! Accept Bid button properly gates blockchain operations.The disabled condition correctly prioritizes
settings.isBlockchainDown, preventing both lease creation and manifest resend when blockchain is down. The fix from previous review comments has been properly applied.apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx (2)
151-187: LGTM! Test properly verifies blockchain-down gating.The test correctly isolates the
isBlockchainDowncondition by selecting a bid first, ensuring the button's disabled state is due to blockchain downtime rather than missing selection. UsesqueryBymethods as per coding guidelines.
403-403: LGTM! Test harness properly wired for settings.The
isBlockchainDownparameter anduseSettingsmock correctly propagate blockchain state to the component under test, enabling comprehensive testing of the gating logic.Also applies to: 499-514
apps/deploy-web/src/components/layout/TopBanner.tsx (1)
49-65: LGTM! Clean priority-based banner rendering.The orchestrator correctly renders banners in priority order (maintenance → network down → credit card), preventing overlap. The if-else structure ensures mutual exclusivity.
apps/deploy-web/src/components/layout/Layout.tsx (2)
104-104: className prop usage is valid. Nav’s className prop accepts ClassValue and is merged via cn(), which natively supports object literals for conditional classes. No changes needed.
112-112: Incorrect review comment: mdDrawerClassName object syntax is valid. Sidebar’smdDrawerClassNameprop is typed asClassValue(supports object mappings) and is applied viaclsx, so usingmdDrawerClassName={{ ["h-[calc(100%-40px)] mt-[97px]"]: hasBanner }}will correctly include those classes when
hasBanneris true. No change needed.Likely an incorrect or invalid review comment.
closes #1948
Summary by CodeRabbit
New Features
Refactor
Style
Tests