Conversation
8936cf1 to
a656f14
Compare
Signed-off-by: Timothy Bess <tim@prospective.dev>
1c89ff8 to
f8705cf
Compare
Signed-off-by: Andrew Stein <steinlink@gmail.com>
Signed-off-by: Andrew Stein <steinlink@gmail.com>
bc413a4 to
05ec5c7
Compare
Signed-off-by: Andrew Stein <steinlink@gmail.com>
05ec5c7 to
852ef20
Compare
7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR creates a new package
@finos/perspective-react, a dedicated Perspective integration library for the React JavaScript framework.This abstraction is intended to be lightweight over Perspective's browser native API, with the only design goal being to lessen the impedance mismatch between Perspective's internally stateful (and imperative) Custom Element API, and React's functional design. More relevant than the new
PerspectiveVIewerReact component, is the underlying API changes to the<perspective-viewer>Custom Element which makes integration possible:Table::delete,View::delete,Client::terminateandHTMLPerspectiveViewerElement::deleteare now fully destructive, and calling any method on their objects afterwards will throw a definitive null pointer dereference error. Calling these methods unrecoverably & completely deallocates their associated objects, not just their handles.Tablereturned byClient::open_table) can be deallocated but not deleted remotely viatable.free()in JavaScript (Python does not leak handles).Table::deletehas a new options parameter, which has a single boolean propertylazy, which defers the deletion until theViewcount for thisTablenaturally reaches zero. Be careful not to overuse this - it is easy to "leak"Tableby usinglazywithout remembering to cleanup allHTMLPerspectiveViewerElement(and henceViewobjects) which use it, effectively leaking theTablewithout a warning. Thelazyproperty just makes ordering this method call easier in React where it is difficult to signal when all dependencies Custom Elements have been destroyed byReact.useEffectdestructors (which may be nested opaquely in the component graph) - it does not absolve you from callingView::deleteorHTMLPerspectiveViewerElement::deleteon dependencies inReact.useEffectin the first place.HTMLPerspectiveViewerElement::ejectis the reciprocal ofHTMLPerspectiveViewerElement::load, removing any loadedTableand reverting the element to its initial state. This is different fromHTMLPerspectiveViewerElement::delete, which deallocates the element entirely (and can't be recovered).HTMLPerspectiveViewerElement::loadis now equivalent toHTMLPerspectiveViewerElement::resetif theTableis already loaded (has the sameClientinstance and table name.Drive-by changes:
pyo3andwasm_bindgenwere struggling to handle these, and even where it worked it was quirky. This change, for example, makes@finos/perspectiveTypeScript types to have their APIs get proper tsdocs. Some ancillary build steps were pruned as well.