Skip to content

Commit 966bf51

Browse files
committed
Merge branch 'main' into df-docs
* main: bug(data frame): Make sure all original patch locations exit saving state (#1529) bug(TS): Update deps to latest versions: (#1524)
2 parents c7bfb7e + a393b49 commit 966bf51

File tree

15 files changed

+255
-254
lines changed

15 files changed

+255
-254
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
5555

5656
* Fixed #1440: When a Shiny Express app with a `www/` subdirectory was deployed to shinyapps.io or a Connect server, it would not start correctly. (#1442)
5757

58+
* Fixed #1498: Update table related TypeScript dependencies to their latest versions. This fixed an issue where the Row Virtualizer would scroll to the end when hidden. This would cause the DOM to update numerous times, locking up the browser tab for multiple seconds. #1524
59+
5860
* The return type for the data frame patch function now returns a list of `render.CellPatch` objects (which support `htmltools.TagNode` for the `value` attribute). These values will be set inside the data frame's `.data_view()` result. This also means that `.cell_patches()` will be a list of `render.CellPatch` objects. (#1526)
5961

62+
* Made sure all `@render.data_frame` cells that have been edited are now restored back to ready state to handle the off chance that the returned patches are at different locations the the original edit patches. (#1529)
63+
64+
6065
### Other changes
6166

6267
## [0.10.2] - 2024-05-28

js/data-frame/data-update.tsx

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,21 @@ export function updateCellsData({
8585
draft[rowIndex]![columnIndex] = value;
8686
});
8787
});
88+
89+
// Set the old patches locations back to success state
90+
// This may be overkill, but it guarantees that the incoming patches exit the saving state
91+
patches.forEach(({ rowIndex, columnIndex, value }) => {
92+
setCellEditMapAtLoc(rowIndex, columnIndex, (obj_draft) => {
93+
// If the cell is still saving, then set it back to ready.
94+
// If not, then something else has changed the cell state, so don't change it.
95+
if (obj_draft.state !== CellStateEnum.EditSaving) return;
96+
97+
obj_draft.state = CellStateEnum.Ready;
98+
obj_draft.value = value;
99+
obj_draft.errorTitle = undefined;
100+
});
101+
});
102+
// Set the new patches
88103
newPatches.forEach(({ rowIndex, columnIndex, value }) => {
89104
setCellEditMapAtLoc(rowIndex, columnIndex, (obj_draft) => {
90105
obj_draft.value = value;
@@ -98,7 +113,6 @@ export function updateCellsData({
98113
.catch((err: string) => {
99114
patches.forEach(({ rowIndex, columnIndex, value }) => {
100115
setCellEditMapAtLoc(rowIndex, columnIndex, (obj_draft) => {
101-
// Do not overwrite value!
102116
obj_draft.value = String(value);
103117

104118
obj_draft.state = CellStateEnum.EditFailure;

js/data-frame/filter.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {
2+
ColumnFiltersOptions,
23
ColumnFiltersState,
34
FilterMeta,
4-
FiltersOptions,
55
Header,
66
Row,
77
getFacetedMinMaxValues,
@@ -25,7 +25,7 @@ export function useFilters<TData>(enabled: boolean | undefined): {
2525
columnFilters: ColumnFiltersState;
2626
setColumnFilters: React.Dispatch<React.SetStateAction<ColumnFiltersState>>;
2727
columnFiltersState: { columnFilters: ColumnFiltersState };
28-
filtersTableOptions: FiltersOptions<TData>;
28+
filtersTableOptions: ColumnFiltersOptions<TData>;
2929
} {
3030
const [columnFilters, setColumnFilters] = useState<ColumnFiltersState>([]); // can set initial column filter state here
3131

js/data-frame/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,10 +278,11 @@ const ShinyDataGrid: FC<ShinyDataGridProps<unknown>> = ({
278278
count: table.getFilteredRowModel().rows.length,
279279
getScrollElement: () => containerRef.current,
280280
estimateSize: () => 31,
281+
overscan: 15,
281282
paddingStart: theadRef.current?.clientHeight ?? 0,
282283
// In response to https://github.com/posit-dev/py-shiny/pull/538/files#r1228352446
283284
// (the default scrollingDelay is 150)
284-
scrollingDelay: 10,
285+
isScrollingResetDelay: 10,
285286
});
286287

287288
// Reset scroll when dataset changes

js/data-frame/table-summary.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import React, { useMemo } from "react";
1313
export function useSummary(
1414
summaryTemplate: string | boolean | undefined,
1515
scrollContainer: HTMLElement | null,
16-
virtualRows: VirtualItem[],
16+
virtualRows: VirtualItem<Element>[],
1717
thead: HTMLTableSectionElement | null,
1818
nrows: number
1919
): JSX.Element | null {

0 commit comments

Comments
 (0)