API Reference / @evolu/common / Evolu/Internal / kyselyJsonIdentifier
Variable: kyselyJsonIdentifier
const kyselyJsonIdentifier: string;
Defined in: packages/common/src/Evolu/Diff.ts:106
A unique identifier prepended to JSON-encoded strings. This allows safe detection and parsing of only those columns that require JSON.parse.
The identifier is generated using nanoid to ensure randomness and uniqueness, preventing malicious actors from inserting fake data that could be misinterpreted as JSON by the application.
Note: The same queries created by different browser tabs will have different identifiers and thus be considered different and cached separately. This is usually not a big deal, but if needed, the DB cache can be optimized by passing the kyselyJsonIdentifier into the DB worker during initialization, allowing queries to be grouped and recognized across tabs or sessions.
See: https://github.com/kysely-org/kysely/issues/1372#issuecomment-2702773948