Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gongo-client-react

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gongo-client-react - npm Package Compare versions

Comparing version 0.2.1 to 0.2.2

6

lib/liveQueries.d.ts

@@ -7,7 +7,7 @@ import { Database, Cursor } from "gongo-client";

declare type CursorFunc<DocType extends Document> = (db: Database) => Cursor<DocType>;
declare const useGongoCursor: <DocType extends Document>(cursorFunc: CursorFunc<DocType>, opts?: useGongoCursorOpts) => Cursor<DocType>;
declare const useGongoLive: <DocType extends Document>(cursorFunc: CursorFunc<DocType>, opts?: useGongoCursorOpts) => import("gongo-client/lib/browser/Collection").WithId<DocType>[];
declare const useGongoOne: <DocType extends Document>(origCursorFunc: CursorFunc<DocType>, opts?: useGongoCursorOpts) => import("gongo-client/lib/browser/Collection").WithId<DocType>;
declare const useGongoCursor: <DocType extends Document>(cursorFunc: false | CursorFunc<DocType> | null | undefined, opts?: useGongoCursorOpts) => false | Cursor<DocType> | null | undefined;
declare const useGongoLive: <DocType extends Document>(cursorFunc: false | CursorFunc<DocType> | null | undefined, opts?: useGongoCursorOpts) => import("gongo-client/lib/browser/Collection").WithId<DocType>[];
declare const useGongoOne: <DocType extends Document>(origCursorFunc: CursorFunc<DocType>, opts?: useGongoCursorOpts) => import("gongo-client/lib/browser/Collection").WithId<DocType> | null;
declare function useGongoUserId(): unknown;
export { useGongoCursor, useGongoLive, useGongoOne, useGongoUserId };
//# sourceMappingURL=liveQueries.d.ts.map

@@ -25,2 +25,3 @@ "use strict";

if (newCursor &&
cursor &&
// BUG FIX from: newCursor._skip === cursor.skip (not _skip)... untested!

@@ -64,7 +65,10 @@ !(newCursor._skip === cursor._skip && newCursor._limit === cursor._limit)) {

function cursorFunc(db) {
const cursor = origCursorFunc(db);
const cursor = origCursorFunc && origCursorFunc(db);
return cursor && cursor.limit(1);
}
const data = useGongoLive(cursorFunc, opts);
return data[0];
if (data.length > 0)
return data[0];
else
return null;
};

@@ -71,0 +75,0 @@ exports.useGongoOne = useGongoOne;

{
"name": "gongo-client-react",
"version": "0.2.1",
"version": "0.2.2",
"author": "Gadi Cohen <dragon@wastelands.net>",

@@ -5,0 +5,0 @@ "description": "React hooks for GongoJS gongo-client",

@@ -15,3 +15,3 @@ import { useState, useEffect, useMemo } from "react";

const useGongoCursor = <DocType extends Document>(
cursorFunc: CursorFunc<DocType>,
cursorFunc: CursorFunc<DocType> | null | undefined | false,
opts?: useGongoCursorOpts

@@ -37,2 +37,3 @@ ) => {

newCursor &&
cursor &&
// BUG FIX from: newCursor._skip === cursor.skip (not _skip)... untested!

@@ -76,3 +77,3 @@ !(newCursor._skip === cursor._skip && newCursor._limit === cursor._limit)

const useGongoLive = <DocType extends Document>(
cursorFunc: CursorFunc<DocType>,
cursorFunc: Parameters<typeof useGongoCursor<DocType>>[0],
opts?: useGongoCursorOpts

@@ -95,7 +96,8 @@ ) => {

function cursorFunc(db: Database) {
const cursor = origCursorFunc(db);
const cursor = origCursorFunc && origCursorFunc(db);
return cursor && cursor.limit(1);
}
const data = useGongoLive(cursorFunc, opts);
return data[0];
if (data.length > 0) return data[0];
else return null;
};

@@ -102,0 +104,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc