Rules Hub
Coding Rules Library
← Back to all rules
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
fullstack ruleP1universalStack: typescript
serializationdata-structuresserver-actionscorrectness
Don't pass a Set across a serialization boundary; use an array
A Set serializes to {} over server-action/JSON boundaries; pass an array (or object) for membership checks that must cross the wire.
PR: hegnar-journalist-boost · org-mining-deep-2026-06Created: Jun 17, 2026
Bad example
Old codetypescript
| 1 | // Set becomes {} when sent to a server action |
| 2 | await pushArticle({ fieldsToPush: new Set(['seoTitle']) }); |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | await pushArticle({ fieldsToPush: ['seoTitle'] }); // array survives serialization |
Explanation (EN)
Objašnjenje (HR)