Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@
export let label: string;
export let value: number;
export let limited: boolean = false;
export let column: Models.ColumnInteger;
export let column: Models.ColumnInteger | Models.ColumnFloat;

const FLOAT_INPUT_STEP = 0.001;

$: autofocus = limited;
$: nullable = !limited ? !column.required : false;
$: isDecimalColumn = ['double', 'float'].includes(column.type as string);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Locate the files mentioned in the review
find . -name "integer.svelte" -path "*/rows/columns/types/*" 2>/dev/null
find . -name "column.svelte" -path "*/rows/columns/*" 2>/dev/null
find . -name "float.svelte" -path "*/rows/columns/types/*" 2>/dev/null

Repository: appwrite/console

Length of output: 308


🏁 Script executed:

#!/bin/bash
# Check the actual line 16 in integer.svelte
FILE="src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/rows/columns/types/integer.svelte"
if [ -f "$FILE" ]; then
  cat -n "$FILE" | head -20
else
  echo "File not found at expected path"
fi

Repository: appwrite/console

Length of output: 854


🏁 Script executed:

#!/bin/bash
# Search for column.svelte in rows/columns directory
find . -name "column.svelte" -type f 2>/dev/null | grep -E "rows/columns" | head -5

Repository: appwrite/console

Length of output: 180


🏁 Script executed:

#!/bin/bash
# Read the column.svelte dispatcher
FILE="src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/rows/columns/column.svelte"
cat -n "$FILE"

Repository: appwrite/console

Length of output: 3540


🏁 Script executed:

#!/bin/bash
# Check if float.svelte exists in types directory
find . -path "*/rows/columns/types/float.svelte" 2>/dev/null

Repository: appwrite/console

Length of output: 42


🏁 Script executed:

#!/bin/bash
# Also search for any float.svelte in the databases area
find . -name "float.svelte" -path "*/databases/*" 2>/dev/null

Repository: appwrite/console

Length of output: 174


🏁 Script executed:

#!/bin/bash
# Search for float references in rows/columns directory
rg "float" src/routes/\(console\)/project-\*-/databases/database-\*/table-\*/rows/columns/ --type svelte -i

Repository: appwrite/console

Length of output: 90


🏁 Script executed:

#!/bin/bash
# Check the float.svelte in columns directory to understand the pattern
FILE="src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/columns/float.svelte"
cat -n "$FILE" | head -30

Repository: appwrite/console

Length of output: 1215


🏁 Script executed:

#!/bin/bash
# Search for float references in rows/columns directory without type filter
rg "float" "src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/rows/columns/"

Repository: appwrite/console

Length of output: 616


🏁 Script executed:

#!/bin/bash
# Check if there are any other column type files that might handle float
ls -la "src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/rows/columns/types/"

Repository: appwrite/console

Length of output: 879


Float column type is not mapped in the row editing dispatcher, making the float check unreachable.

The component at line 16 checks for float: $: isDecimalColumn = ['double', 'float'].includes(column.type as string);, and integer.svelte accepts Models.ColumnFloat (line 10), but the dispatcher in column.svelte only maps double: Integer without mapping float. This causes float columns to fail rendering in the rows context since there is no separate float.svelte for row editing.

Add float: Integer to the columnsTypeMap in column.svelte to route float columns to the integer component.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@src/routes/`(console)/project-[region]-[project]/databases/database-[database]/table-[table]/rows/columns/types/integer.svelte
at line 16, The float column type is not routed to the integer row-editor, so
update the dispatcher mapping in column.svelte: add the entry `float: Integer`
to the columnsTypeMap (the same map that currently contains `double: Integer`)
so Models.ColumnFloat columns are handled; this ensures the component logic
around `$: isDecimalColumn = ['double', 'float'].includes(column.type as
string);` and the integer.svelte row editor are reachable for float columns.

$: if (limited) {
label = undefined;
}
Expand All @@ -25,5 +28,5 @@
min={column.min}
max={column.max}
required={column.required}
step={column.type === 'double' ? 'any' : 1}
step={isDecimalColumn ? FLOAT_INPUT_STEP : 1}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 step="0.001" breaks high-precision float input

Changing from step="any" to FLOAT_INPUT_STEP (0.001) means the browser's native step-mismatch validation will reject any value that isn't an exact multiple of 0.001. This breaks editing of double/float documents that contain values with more than 3 decimal places (e.g. 3.14159265, 1.23456789). The old step="any" was intentionally unrestricted and was the correct choice for arbitrary-precision floating-point columns.

With step="any" the stepMismatch validity flag is never set and any number (satisfying min/max) is accepted. With step="0.001" the browser rejects values like 1.2345 with a stepMismatch error, blocking form submission entirely.

Suggested change
step={isDecimalColumn ? FLOAT_INPUT_STEP : 1}
step={isDecimalColumn ? 'any' : 1}

leadingIcon={!limited ? IconHashtag : undefined} />