SShortSingh.
Back to feed

How a null vs. undefined mismatch broke task editing in a Zod-validated app

0
·31 views

A developer building FocusYar, a task management app, encountered a bug where editing a task without a priority field triggered an error reading 'There is nothing task.' The root cause was a mismatch between the value stored in the database — null — and the value the Zod validation schema was checking for — undefined. Because null, undefined, and empty string are treated differently in JavaScript, the preprocessing logic failed to convert the database value into an acceptable form before validation. The fix involved updating the Zod schema to check for null instead of undefined, allowing the empty priority field to pass through correctly. The experience highlighted the importance of tracing a value's actual state across every layer of an application — UI, database, schema, and server action — when debugging optional fields.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingDEV Community ·

Fable/Mythos 5.2: lower prices and long-running agent tasks signal a shift for coding models

The article examines Fable/Mythos 5.2, a coding-focused model release that appears designed for long, multi-step workloads rather than isolated snippets. Fable carries tighter guardrails, while Mythos is a more permissive profile aimed at enterprise settings with structured security processes. The announced pricing drops to $8 input and $40 output, and the suggested approach is a stable general model for routine tasks, reserving the more powerful model for demanding burst work. Demonstrations include swarms of around 1,000 sub-agents and an attempt to build a bootable operating system from an empty folder, which the author presents as signs of greater coherence over large projects. The piece argues that benchmark numbers matter less than how such models handle real, verifiable engineering constraints.

0
ProgrammingDEV Community ·

Shopify equipment calculator compares unit costs and payback for store products

A case study describes building a cost and payback calculator for a Shopify equipment store, using a Webflow mortgage-broker site as its design and routing inspiration. The article notes that high-ticket products like home batteries and coffee machines need pages that explain both upfront price and long-term operating cost. It works through examples across categories such as home energy storage, coffee equipment, packaging and water-filter refills, with simple payback figures that are explicitly labelled as arithmetic illustrations rather than proven performance. The author cautions that scenario selectors only route visitors and do not establish compatibility, financing approval, or real customer returns. It also advises against copying placeholder review counts or certifications from design artwork, showing only genuine reviews and payment methods a store can actually offer.

0
ProgrammingDEV Community ·

ariaNotify() Arrives as Baseline, Offering Script-Driven Screen Reader Announcements

A new web API method, ariaNotify(), was introduced in September 2026 as a way to trigger screen reader announcements programmatically. It was first proposed in the WAI-ARIA 1.3 draft in 2024 and now has full support in Chrome, Firefox, Edge, and Safari. Unlike live regions, which require a hidden DOM element and announce only when its content structurally changes, ariaNotify() queues text for announcement directly through JavaScript. The author stresses that live regions are not being fully replaced, despite the title's suggestion. The piece also reviews how live regions currently work, covering roles like status and alert and attributes such as aria-live, aria-atomic, aria-busy, and aria-relevant.

0
ProgrammingDEV Community ·

Developer launches WandFX photo-to-video tool and ShopCutout product background remover

A developer has released two narrow web tools and shared them with the DEV Community for feedback. WandFX turns a single uploaded photo, such as a pet or consenting adult portrait, into a 4-8 second video using ready-made effects powered by MiniMax models, with some effects including AI-generated sound. ShopCutout removes product photo backgrounds in the browser, letting sellers export transparent PNGs or white-background JPGs sized for Amazon, Etsy, and Shopify, with batch processing of up to 20 photos. Eligible new WandFX users can try one free pet video, followed by non-expiring pay-as-you-go credits, while ShopCutout's basic local processing is free with no watermark or signup. The developer is asking users to report what works and what doesn't.