Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline

## Dev

## 5.1.6 - 2025-07-09

### Fix

* **client-api**: Fix handling of addFilters and addExclusions calls with empty arg to prevent either function from stalling client-api initialization.
* **client-api-react**: Fix updating props or using ref functions ocasionally causing repeated function calls.

## 5.1.5 - 2025-06-18

### Added

* **client-api**: Add `resetFilters` and `resetExclusions` calls, requires minimum Graphistry version 2.42.18
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "5.1.5",
"version": "5.1.6",
"packages": [
"projects/client-api",
"projects/client-api-react",
Expand Down
6 changes: 3 additions & 3 deletions projects/client-api-react/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions projects/client-api-react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@graphistry/client-api-react",
"version": "5.1.5",
"version": "5.1.6",
"repository": {
"type": "git",
"url": "git+https://github.com/graphistry/graphistry-js.git"
Expand Down Expand Up @@ -69,7 +69,7 @@
"author": "Graphistry, Inc <https://graphistry.com>",
"license": "ISC",
"dependencies": {
"@graphistry/client-api": "^5.1.5",
"@graphistry/client-api": "^5.1.6",
"crypto-browserify": "3.12.0",
"prop-types": ">=15.6.0",
"shallowequal": "1.1.0",
Expand Down
22 changes: 8 additions & 14 deletions projects/client-api-react/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -360,24 +360,22 @@ function handleUpdates({ g, isFirstRun, axesMap, props }) {
}


// Regenerate on url change
function generateIframeRef({
setLoading, setLoadingMessage, setG, setGSub, setGObs, setGErr, setFirstRun,
url, dataset, props,
url, props,
axesMap,
iframeStyle, iframeClassName, iframeProps, allowFullScreen,
tolerateLoadErrors
}) {

console.debug('@generateIframeRef', { url, dataset, props, axesMap, iframeStyle, iframeClassName, iframeProps, allowFullScreen, tolerateLoadErrors });
console.debug('@generateIframeRef', { url, props, axesMap, tolerateLoadErrors });

return useCallback(iframe => {
if (iframe && dataset) {
console.debug('@generateIframeRef callback', { iframe, dataset });
if (iframe && url) {
console.debug('@generateIframeRef callback', { iframe, url });
let loaded = false;
setLoading(true);
setLoadingMessage('Fetching session');
console.debug('new iframe', typeof (iframe), { iframe, dataset, propsDataset: props.dataset });
console.debug('new iframe', typeof (iframe), { iframe, url, propsDataset: props.dataset });
const source = graphistryJS(iframe);
const obs = source.pipe(
tap(g => { console.debug('new graphistryJS', g); }),
Expand Down Expand Up @@ -442,13 +440,10 @@ function generateIframeRef({
setGObs(null);
}
} else {
console.debug('no iframe', typeof (iframe), { iframe, dataset });
console.debug('no iframe', typeof (iframe), { iframe, url });
return () => { };
}
}, [
url,
iframeStyle, iframeClassName, iframeProps, allowFullScreen
]);
}, [ url ]);
}

// iframe refreshes on key arg changes: via <iframe key={f(url)}
Expand Down Expand Up @@ -596,9 +591,8 @@ const Graphistry = forwardRef((props, ref) => {
//Initial frame load and settings
const iframeRef = generateIframeRef({
setLoading, setLoadingMessage, setG, setGSub, setGObs, setGErr, setFirstRun,
url, dataset, props,
url, props,
axesMap,
iframeStyle, iframeClassName, iframeProps, allowFullScreen,
tolerateLoadErrors
});

Expand Down
6 changes: 3 additions & 3 deletions projects/client-api/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions projects/client-api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@graphistry/client-api",
"version": "5.1.5",
"version": "5.1.6",
"description": "Client-side API for interacting with a Graphistry embedded visualization.",
"jsnext:main": "dist/index.js",
"config": {
Expand Down Expand Up @@ -85,7 +85,7 @@
"@graphistry/falcor-json-graph": "^2.9.10",
"@graphistry/falcor-model-rxjs": "2.11.0",
"@graphistry/falcor-socket-datasource": "2.11.3",
"@graphistry/js-upload-api": "^5.1.5",
"@graphistry/js-upload-api": "^5.1.6",
"shallowequal": "1.1.0"
},
"peerDependencies": {
Expand Down
42 changes: 31 additions & 11 deletions projects/client-api/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1204,8 +1204,15 @@ export function addFilters(expr) {
}

return switchMap(g => {
return forkJoin(expr.map(e => of(g).pipe(addFilter(e))))
.pipe(map((results) => g.updateStateWithResult(results)));
const observables = expr.length > 0
? expr.map(e => of(g).pipe(addFilter(e)))
: [of(null)];

return forkJoin(observables)
.pipe(map((results) => {
const finalResults = expr.length > 0 ? results : [];
return g.updateStateWithResult(finalResults);
}));
});
}
chainList.addFilters = addFilters;
Expand Down Expand Up @@ -1262,8 +1269,15 @@ export function addExclusions(expr) {
}

return switchMap(g => {
return forkJoin(expr.map(e => of(g).pipe(addExclusion(e))))
.pipe(map((results) => g.updateStateWithResult(results)));
const observables = expr.length > 0
? expr.map(e => of(g).pipe(addExclusion(e)))
: [of(null)];

return forkJoin(observables)
.pipe(map((results) => {
const finalResults = expr.length > 0 ? results : [];
return g.updateStateWithResult(finalResults);
}));
});
}
chainList.addExclusions = addExclusions;
Expand Down Expand Up @@ -1456,16 +1470,18 @@ export function selectionUpdates(g, {withColumns=false, pageSize=1000} = {}) {
return throwError(() => new Error('selectionUpdates is not available the currently embedded graphistry viz.'));
}

const { contentWindow } = g.iFrame;

const selectionPath = ".selection.labels";
return g.selectionStream || (g.selectionStream = new BehaviorSubject('Initialize selectionUpdates stream')
.pipe(
tap(() => {
console.debug('postMessage subscription', '@client-api.selectionUpdates');
g.iFrame.contentWindow.postMessage({ type: 'graphistry-subscribe', agent: 'graphistryjs', path: selectionPath, options: { pageSize, withColumns } }, '*');
contentWindow.postMessage({ type: 'graphistry-subscribe', agent: 'graphistryjs', path: selectionPath, options: { pageSize, withColumns } }, '*');
}),
finalize(() => {
console.debug('postMessage unsubscribe', '@client-api.selectionUpdates');
g.iFrame.contentWindow.postMessage({ type: 'graphistry-unsubscribe', agent: 'graphistryjs', path: selectionPath }, '*');
contentWindow.postMessage({ type: 'graphistry-unsubscribe', agent: 'graphistryjs', path: selectionPath }, '*');
}),
switchMap(() =>
fromEvent(window, 'message').pipe(
Expand Down Expand Up @@ -1582,14 +1598,16 @@ export function labelUpdates(g={}) {
shareReplay({ bufferSize: 1, refCount: true }),
);
} else {
const { contentWindow } = g.iFrame;

src = new BehaviorSubject('value').pipe(
tap((v) => {
tap(() => {
console.debug('postMessage subscription', '@client-api.labelUpdates');
g.iFrame.contentWindow.postMessage({ type: 'graphistry-subscribe', agent: 'graphistryjs', path: LABELS_PATH }, '*');
contentWindow.postMessage({ type: 'graphistry-subscribe', agent: 'graphistryjs', path: LABELS_PATH }, '*');
}),
finalize(() => {
console.debug('postMessage subscription', '@client-api.labelUpdates');
g.iFrame.contentWindow.postMessage({ type: 'graphistry-unsubscribe', agent: 'graphistryjs', path: LABELS_PATH }, '*');
contentWindow.postMessage({ type: 'graphistry-unsubscribe', agent: 'graphistryjs', path: LABELS_PATH }, '*');
}),
switchMap(() =>
fromEvent(window, 'message').pipe(
Expand Down Expand Up @@ -1717,16 +1735,18 @@ export function playUpdates(g) {
return throwError(() => new Error('playUpdates is not available the currently embedded graphistry viz.'));
}

const { contentWindow } = g.iFrame;

const selectionPath = ".labels";
return (new BehaviorSubject('Initialize playUpdates stream')
.pipe(
tap(() => {
console.debug('postMessage subscription', '@client-api.playUpdate');
g.iFrame.contentWindow.postMessage({ type: 'graphistry-subscribe', agent: 'graphistryjs', path: selectionPath }, '*');
contentWindow.postMessage({ type: 'graphistry-subscribe', agent: 'graphistryjs', path: selectionPath }, '*');
}),
finalize(() => {
console.debug('postMessage unsubscribe', '@client-api.playUpdate');
g.iFrame.contentWindow.postMessage({ type: 'graphistry-unsubscribe', agent: 'graphistryjs', path: selectionPath }, '*');
contentWindow.postMessage({ type: 'graphistry-unsubscribe', agent: 'graphistryjs', path: selectionPath }, '*');
}),
switchMap(() =>
fromEvent(window, 'message').pipe(
Expand Down
4 changes: 2 additions & 2 deletions projects/cra-template/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion projects/cra-template/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@graphistry/cra-template",
"version": "5.1.5",
"version": "5.1.6",
"private": true,
"main": "dist/index.cjs.js",
"module": "dist/index.esm.js",
Expand Down
4 changes: 2 additions & 2 deletions projects/cra-test-18/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions projects/cra-test-18/package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "test18",
"version": "5.1.5",
"version": "5.1.6",
"private": true,
"dependencies": {
"@graphistry/client-api-react": "^5.1.5",
"@graphistry/client-api-react": "^5.1.6",
"@testing-library/jest-dom": "^5.16.4",
"@testing-library/react": "^13.2.0",
"@testing-library/user-event": "^13.5.0",
Expand Down
6 changes: 3 additions & 3 deletions projects/cra-test/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions projects/cra-test/package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "@graphistry/client-react-app-cra-test",
"version": "5.1.5",
"version": "5.1.6",
"private": true,
"dependencies": {
"@craco/craco": "^6.4.2",
"@graphistry/client-api-react": "^5.1.5",
"@graphistry/client-api-react": "^5.1.6",
"@testing-library/jest-dom": "^5.16.4",
"@testing-library/react": "^12.1.5",
"@testing-library/user-event": "^14.2.0",
Expand Down
2 changes: 1 addition & 1 deletion projects/js-upload-api/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion projects/js-upload-api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@graphistry/js-upload-api",
"version": "5.1.5",
"version": "5.1.6",
"repository": {
"type": "git",
"url": "git+https://github.com/graphistry/graphistry-js.git"
Expand Down
2 changes: 1 addition & 1 deletion projects/node-api-test-cjs/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions projects/node-api-test-cjs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@graphistry/node-api-test-cjs",
"version": "5.1.5",
"version": "5.1.6",
"description": "",
"main": "src/index.js",
"type": "commonjs",
Expand All @@ -16,7 +16,7 @@
"author": "Graphistry, Inc.",
"license": "Apache-2.0",
"dependencies": {
"@graphistry/node-api": "^5.1.5",
"@graphistry/node-api": "^5.1.6",
"apache-arrow": "^11.0.0"
}
}
2 changes: 1 addition & 1 deletion projects/node-api-test/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading