fix(recipes): don't leak 0 next to private recipe titles#129
Merged
Conversation
`recipe.isPublic` is an integer column (0|1), so `{recipe.isPublic && <Globe/>}`
rendered a literal "0" next to the recipe name on private cards.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Preview deployment
|
5 tasks
hyldmo
added a commit
that referenced
this pull request
May 11, 2026
* refactor(db): use Drizzle boolean mode for 0|1 flag columns
Switches `isPublic`, `isDefault`, `isVolume`, `failureFlag`, `batchLookups`,
and `modelFallback` to `integer(..., { mode: 'boolean' })`. The on-disk
representation stays as INTEGER 0/1 — this is purely a TS-layer codec.
Side effect: `{flag && <X/>}` short-circuits to `false` (which React skips)
instead of rendering the literal `0`. Prevents the whole class of bugs that
hit `recipe.isPublic` in #129.
Call sites updated: writes pass true/false directly (no more `? 1 : 0`),
reads compare against booleans, and the API layer drops its `Boolean(...)`
coercion wrappers since the column already returns boolean.
The generated migration is a no-op (`SELECT 1`) — Drizzle wants to recreate
five tables to refresh the schema string, but the actual SQLite column type
is unchanged, so production data needs no rewrite.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* refactor(db): drop redundant boolean coercion at trust boundaries
Zod schemas (`z.boolean()` / `z.boolean().optional()`) already narrow these
inputs to `boolean | undefined` before they reach the handlers, so the `!!`
and `=== true` coercions added in c3abc1b were noise.
- workouts/addSet: `failureFlag: !!input.failureFlag` → pass through
- ingredients/createUnit: same for `isDefault`
- ingredients/updateUnit: drop the explicit `isDefault` override; just spread
`updates` (the inner `if (updates.isDefault)` already clears siblings)
- WorkoutSessionPage optimistic update: pass `variables.failureFlag` directly
- SetRow: `failureFlag === true` → `failureFlag` (null/undefined fall through
as falsy, which is what JSX wants anyway)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
recipe.isPublicis an integer column (0 | 1), so{recipe.isPublic && <Globe/>}inRecipeCardrendered the literal0next to the recipe name on every private card.=== 1so the falsy branch isfalse(not0) and React renders nothing.Test plan
0after the "yours" badge🤖 Generated with Claude Code