feat: Neuroglancer Views cart pipeline (PR 5a, ngviews-05a-cart-pipeline) - #426
Draft
allison-truhlar wants to merge 16 commits into
Draft
feat: Neuroglancer Views cart pipeline (PR 5a, ngviews-05a-cart-pipeline)#426allison-truhlar wants to merge 16 commits into
allison-truhlar wants to merge 16 commits into
Conversation
Wire useCartContext into FileBrowser and add a context-menu item that adds the right-clicked folder to the Neuroglancer cart, guarded by the same is_dir && !is_symlink condition the existing folder-only menu items (Set favorite, Convert to OME-Zarr) already use. Also add CartProvider to the shared test harness (test-utils.tsx), matching its real nesting in MainLayout -- FileBrowser is a shared surface and now depends on CartContext, which the harness didn't provide, breaking FileTableSelectColumn.test.tsx.
The "Add to Neuroglancer cart" menu item called addToCart without awaiting it and toasted success unconditionally, so a rejected preference mutation left an unhandled rejection and a false-positive success toast. Await it in a try/catch and mirror the sibling Set favorite item's error-toast pattern.
removeFromCart in a loop closed over the same pre-loop cart snapshot on every awaited iteration, so removing a multi-entry dataset (base + checked channels) only persisted the last removal - earlier entries got reintroduced. Add removeManyFromCart (single filter, single persist) and use it from CartDatasetRow's remove-all. Also stop a channel-only entry's label from leaking into the dataset row header when no base entry exists.
…; drop dead field
Lazily fetch OME-Zarr metadata on first row expand (same trigger as the existing channel fetch) and render a compact "axis:size" summary next to the dataset label, so a shape mismatch between cart rows (e.g. different Z extents) is visible before checkout instead of only after a misaligned View. Exports getAxesMap from omezarr-helper so CartDatasetRow can map axis name to its arr.shape index.
CreateViewButton now always opens a dialog with a name FgInput pre-filled from defaultName before calling checkout, instead of firing checkout silently when no data-link consent was needed. The data-link consent copy/switch renders inside the same dialog only when new links require consent. The create/continue button is disabled when the trimmed name is empty, and the typed name (not defaultName) is used for both checkout and the success toast.
allison-truhlar
force-pushed
the
ngviews-05a-cart-pipeline
branch
from
August 12, 2026 19:29
58d0cdc to
3b704c1
Compare
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.
Neuroglancer Views — PR 5a (
ngviews-05a-cart-pipeline)Stacked on #425 (
ngviews-04-views-page). Read-only scope. PR 5 was split into 5a + 5b; this is 5a — the file-browser → Layer Cart → saved View pipeline. (5b will add the right-edge Properties↔Cart rail, the Data Link delete-409 dialog, and Properties "Appears in N Views".)What's in it
CartProviderhoisted app-wide (MainLayout, insidePreferencesProvider; removed the route-scoped copy) so the file browser can use the cart.getOmeZarrChannels(url)— lazy channel list for a dataset.buildViewState(datasets)— merges per-datasetomezarr-helpergenerated states into oneng_stateobject +ViewLayerInput[](decode + concat layers; one dataset's failure is skipped, not fatal).useCartCheckout()— resolves/creates one Data Link per unique(fsp_name, path)(shareddatasetKey+normalizeFspRootPathso no duplicate links), builds state,createView.CreateViewButton— consent-gated batch checkout (reusesareDataLinksAutomatic; "don't ask again" toggles the pref). Reused by both entry points.⋯"Add to Neuroglancer cart" (folders only).checkedFiles: Add N to cart · New View from selection · Clear.Collapse), Create View + Clear cart.CartContextgained a batchremoveManyFromCart.Notable review catches (fixed on-branch)
addToCartnow awaited +toast.erroron failure (was a false-success toast + unhandled rejection).removeManyFromCart).Deferred / carry items
sharing_modeis a stored label only (not enforced) — per PR 2."Channel N"labels don't name-match generated layers, sobuildViewState's channel filter falls back to keep-all (over-inclusive, never drops/crashes); omero-labelled datasets filter correctly. Accepted for read-only-first.customdataLinkSubpathModeprefix (cosmetic; links still work). Follow-up.Testing
getOmeZarrChannels,viewCheckout(incl. skip-on-throw + channel-narrow),useCartCheckout,CreateViewButton,FileBrowserCartItem,SelectionBar,CartTab,CartContext.node-prettier-check+node-eslint-checkclean (one pre-existing unrelated lint warning).node-checkshows 5 pre-existing type errors in files 5a does not touch (base-branch types mismatch) — reconcile at the stack level.