@tanstack/react-db
Version:
React integration for @tanstack/db
19 lines (18 loc) • 893 B
JavaScript
let _tanstack_db = require("@tanstack/db");
// src/source-id-bindings.ts
/**
* Reports a descriptor source that no DbClient bound, naming the provider a
* React tree needs. Returns `undefined` when a client can bind descriptors.
*/
function getUnboundDescriptorReporter(client, hookName) {
if (client) return void 0;
return (alias) => {
throw new Error(`[${hookName}] Collection descriptor "${alias}" requires a DbClient when the query is consumed. Wrap this component in <DbProvider client={client}> or use a concrete Collection.`);
};
}
function getPreparedSources(preparedValue, client, hookName) {
return (0, _tanstack_db.getPreparedLiveQuerySources)(preparedValue, getUnboundDescriptorReporter(client, hookName));
}
exports.getPreparedSources = getPreparedSources;
exports.getUnboundDescriptorReporter = getUnboundDescriptorReporter;
//# sourceMappingURL=source-id-bindings.cjs.map