-
Notifications
You must be signed in to change notification settings - Fork 214
fix: adjust max storage conversion and row security change #2842
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
Conversation
Console (appwrite/console)Project ID: Sites (1)
Tip Storage files get ClamAV malware scanning and encryption by default |
WalkthroughThis PR modifies two Svelte components to enhance configuration capabilities. The first refactors maxValue computation from a function-based approach to a reactive value and introduces a reactive step value computed based on selected unit, adjusting template bindings accordingly and using Math.round for rounding. The second expands a params object to include three new fields (rowSecurity, enabled, permissions) sourced from table data, enabling these fields to be updated through the existing SDK flow while maintaining consistent UI bindings. Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
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. Comment |
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.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@src/lib/helpers/unit.ts`:
- Line 56: The use of Math.round in createValueUnitPair corrupts base values for
non-divisible conversions; update the unit subscription handler in
createValueUnitPair to return the exact division (unitInBase / newUnit.value)
without Math.round so fractional base quantities are preserved, and move any
UI-specific rounding logic to the storage/UI layer (not in
createByteUnitPair/createTimeUnitPair/shared createValueUnitPair) where you can
apply Math.round only for display or max-value constraints.
🧹 Nitpick comments (1)
src/routes/(console)/project-[region]-[project]/storage/bucket-[bucket]/settings/updateMaxFileSize.svelte (1)
22-22: Reactive derivation looks correct, but add a safety guard for the.find()call.If
selectedUnitever doesn't match an entry inunits(e.g., due to a future refactor),.valueonundefinedwill throw. A defensive fallback keeps the component resilient:Proposed defensive fallback
- $: maxValue = (service * 1000 * 1000) / units.find((unit) => unit.name === selectedUnit).value; + $: maxValue = (service * 1000 * 1000) / (units.find((unit) => unit.name === selectedUnit)?.value ?? 1);
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.
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)
src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/settings/+page.svelte (1)
20-28:⚠️ Potential issue | 🟡 MinorAvoid passing unused fields to
deleteTable; simplifyupdateTablecalls by extracting only needed fields.The expanded
paramsobject is passed to bothdeleteTableandupdateTable, but they have different needs:
deleteTable({ ...params })includesname,rowSecurity,enabled, andpermissions, but only requiresdatabaseIdandtableId(as shown intable.svelteline 33-36). These extra fields are unnecessary noise.
updateTable({ ...params, ...updates })spreads all current table state before applying the change. While this ensures complete payloads (likely a PUT-style API requirement, per commit "fix: for row security also changing"), it means every update sends all fields—including potentially stale reactive values—which could mask race conditions if concurrent updates occur.For
deleteTable, pass only the required fields:{ tableId: page.params.table, databaseId: page.params.database }. ForupdateTable, consider extracting only the fields actually needed per operation, or document why full payloads are required.
🧹 Nitpick comments (1)
src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/settings/+page.svelte (1)
31-35:deleteTablenow receives unnecessary fields (rowSecurity,enabled,permissions).The
deleteTablefunction spreads the fullparamsobject, which now includes fields irrelevant to a delete operation. While the SDK likely ignores them, it adds noise and could cause issues if the API ever validates unknown fields.Consider destructuring only what's needed:
Proposed fix
async function deleteTable() { + const { databaseId, tableId } = params; await sdk .forProject(page.params.region, page.params.project) - .tablesDB.deleteTable({ ...params }); + .tablesDB.deleteTable({ databaseId, tableId }); }

What does this PR do?
Test Plan
(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work.)
Related PRs and Issues
(If this PR is related to any other PR or resolves any issue or related to any issue link all related PR and issues here.)
Have you read the Contributing Guidelines on issues?
(Write your answer here.)
Summary by CodeRabbit