-
Notifications
You must be signed in to change notification settings - Fork 13
[TASK-6981] (main) fix: disable autocorrect on address input #533
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
21cdaca
cbe99b3
2be48e3
b07a8ca
f7a0b64
1dc2885
36725fc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,6 @@ import { Metadata } from 'next' | |
import { peanut } from '@squirrel-labs/peanut-sdk' | ||
import Layout from '@/components/Global/Layout' | ||
import { PayRequestLink } from '@/components' | ||
import { headers } from 'next/headers' | ||
import { PreviewType } from '@/components/Global/ImageGeneration/LinkPreview' | ||
import { formatAmount, printableAddress } from '@/utils' | ||
|
||
|
@@ -34,8 +33,7 @@ export async function generateMetadata({ searchParams }: Props): Promise<Metadat | |
let previewUrl = '/metadata-img.jpg' | ||
const uuid = searchParams.id ? (Array.isArray(searchParams.id) ? searchParams.id[0] : searchParams.id) : undefined | ||
if (uuid) { | ||
let host = headers().get('host') || 'peanut.to' | ||
host = `${process.env.NODE_ENV === 'development' ? 'http://' : 'https://'}${host}` | ||
const host = process.env.NEXT_PUBLIC_BASE_URL! | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Codebase verification Add proper error handling for the environment variable across all usage locations The non-null assertion (
Since no
const host = process.env.NEXT_PUBLIC_BASE_URL
if (!host) {
throw new Error('NEXT_PUBLIC_BASE_URL environment variable is not set')
} 🔗 Analysis chainAdd proper error handling for the environment variable. The non-null assertion ( - const host = process.env.NEXT_PUBLIC_BASE_URL!
+ const host = process.env.NEXT_PUBLIC_BASE_URL
+ if (!host) {
+ throw new Error('NEXT_PUBLIC_BASE_URL environment variable is not set')
+ } Let's verify the environment variable setup: 🏁 Scripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Description: Check for environment variable usage and configuration
# Check if NEXT_PUBLIC_BASE_URL is defined in environment files
echo "Checking .env* files for NEXT_PUBLIC_BASE_URL..."
fd -t f '^\.env' -x grep -l "NEXT_PUBLIC_BASE_URL"
# Check if there are other files potentially using this environment variable
echo "Checking for other usages of NEXT_PUBLIC_BASE_URL..."
rg "NEXT_PUBLIC_BASE_URL" --type ts --type tsx
Length of output: 555 Script: #!/bin/bash
# Description: Check for environment variable usage with corrected commands
# Check if NEXT_PUBLIC_BASE_URL is defined in environment files (including hidden)
echo "Checking .env* files for NEXT_PUBLIC_BASE_URL..."
fd -H -t f '^\.env' -x grep -l "NEXT_PUBLIC_BASE_URL"
# Check for other usages of NEXT_PUBLIC_BASE_URL using ripgrep
echo "Checking for other usages of NEXT_PUBLIC_BASE_URL..."
rg "NEXT_PUBLIC_BASE_URL" -t typescript -t javascriptreact -t typescriptreact
Length of output: 388 Script: #!/bin/bash
# Description: Simple search for environment variable usage
# Search for any file containing NEXT_PUBLIC_BASE_URL
echo "Searching for NEXT_PUBLIC_BASE_URL usage..."
rg "NEXT_PUBLIC_BASE_URL" --type-add 'tsx:*.tsx' --type-add 'ts:*.ts' --type tsx --type ts
# List all potential environment files
echo "Listing environment files..."
fd -H '\.env'
Length of output: 557 |
||
try { | ||
const linkDetails = await peanut.getRequestLinkDetails({ | ||
uuid, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,9 @@ const RecipientInput = ({ placeholder, value, setValue, onEnter }: RecipientInpu | |
type="text" | ||
placeholder={placeholder} | ||
spellCheck="false" | ||
autoCorrect="off" | ||
autoCapitalize="off" | ||
autoComplete="off" | ||
Comment on lines
+20
to
+22
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Codebase verification Similar input components need the same autocorrect treatment Found two additional components that handle address/recipient input and should have the same autocorrect prevention:
Both components already have 🔗 Analysis chainLGTM! Good practice for address input fields. The addition of Let's verify if similar address input fields exist that might need the same treatment: 🏁 Scripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Description: Find other potential address input components that might need similar attributes
# Search for input elements with address-related terms
rg -l 'address|location|recipient' --type tsx
# Search for other input components that might need these attributes
ast-grep --pattern 'className="input-text'
Length of output: 120 Script: #!/bin/bash
# Let's try different approaches to find similar components
# Search for files containing address-related terms with proper extension
rg -l 'address|location|recipient' -g '*.tsx' -g '*.jsx'
# Search for input components with text type
rg -l 'type=["'\'']text["'\'']' -g '*.tsx' -g '*.jsx'
# Search for components with autocorrect/autocomplete attributes
rg -l 'autoCorrect|autoComplete|autoCapitalize' -g '*.tsx' -g '*.jsx'
# Look for other recipient-related components
rg -l 'recipient' -g '*.tsx' -g '*.jsx'
Length of output: 4841 Script: #!/bin/bash
# Let's check the content of potentially related input components
# Check GeneralRecipientInput component
rg -A 5 'input' src/components/Global/GeneralRecipientInput/index.tsx
# Check AddressInput component
rg -A 5 'input' src/components/Global/AddressInput/index.tsx
# Check ValidatedInput component
rg -A 5 'input' src/components/Global/ValidatedInput/index.tsx
# Look for other input elements with spellCheck attribute
rg 'spellCheck=' -g '*.tsx' -g '*.jsx'
Length of output: 1446
Comment on lines
+20
to
+22
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Q, blocking: @jjramirezn why do we need this in both RecipientInput and ValidatedInput? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, recipient input also will contain addresses and ENS although not validated the issue can be present there too |
||
value={value} | ||
onChange={(e) => setValue(e.target.value)} | ||
onKeyDown={(e) => { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add validation for the environment variable
The non-null assertion operator (
!
) assumesNEXT_PUBLIC_BASE_URL
will always be defined, which could lead to runtime errors if the environment variable is missing.Consider adding validation:
📝 Committable suggestion