diff --git a/demo/react-hooks.html b/demo/react-hooks.html
index dbfb0a1cb..d56aedebd 100644
--- a/demo/react-hooks.html
+++ b/demo/react-hooks.html
@@ -71,7 +71,7 @@
Uncontrolled stack
grid.batchUpdate()
grid.removeAll(false)
items.forEach(({ id }) => grid.makeWidget(refs.current[id].current))
- grid.commit()
+ grid.batchUpdate(false)
}, [items])
return (
diff --git a/doc/CHANGES.md b/doc/CHANGES.md
index 8928e596b..9efa366de 100644
--- a/doc/CHANGES.md
+++ b/doc/CHANGES.md
@@ -5,6 +5,7 @@ Change log
**Table of Contents** *generated with [DocToc](http://doctoc.herokuapp.com/)*
+- [TBD](#tbd)
- [5.1.1 (2022-06-16)](#511-2022-06-16)
- [5.1.0 (2022-05-21)](#510-2022-05-21)
- [5.0.0 (2022-01-10)](#500-2022-01-10)
@@ -68,6 +69,9 @@ Change log
+## TBD
+* changed `commit()` to be `batchUpdate(false)` to make it easier to turn batch on/off. updated doc. old API remains for now
+
## 5.1.1 (2022-06-16)
* fix v5.1.0 regression [#1973](https://github.com/gridstack/gridstack.js/issues/1973) DnD Snap to Animation
diff --git a/doc/README.md b/doc/README.md
index 06fba7430..89418b9f5 100644
--- a/doc/README.md
+++ b/doc/README.md
@@ -30,11 +30,10 @@ gridstack.js API
- [`GridStack.registerEngine(engineClass: typeof GridStackEngine)`](#gridstackregisterengineengineclass-typeof-gridstackengine)
- [API](#api)
- [`addWidget(el?: GridStackWidget | GridStackElement, options?: GridStackWidget)`](#addwidgetel-gridstackwidget--gridstackelement-options-gridstackwidget)
- - [`batchUpdate()`](#batchupdate)
+ - [`batchUpdate(flag = true)`](#batchupdateflag--true)
- [`compact()`](#compact)
- [`cellHeight(val: number, update = true)`](#cellheightval-number-update--true)
- [`cellWidth()`](#cellwidth)
- - [`commit()`](#commit)
- [`column(column: number, layout: ColumnOptions = 'moveScale')`](#columncolumn-number-layout-columnoptions--movescale)
- [`destroy([removeDOM])`](#destroyremovedom)
- [`disable()`](#disable)
@@ -348,9 +347,9 @@ grid.addWidget({w: 3, content: 'hello'});
grid.addWidget('', {w: 3});
```
-### `batchUpdate()`
+### `batchUpdate(flag = true)`
-starts batch updates. You will see no changes until `commit()` method is called.
+use before calling a bunch of `addWidget()` to prevent un-necessary relayouts in between (more efficient) and get a single event callback. You will see no changes until `batchUpdate(false)` is called.
### `compact()`
@@ -368,10 +367,6 @@ grid.cellHeight(grid.cellWidth() * 1.2);
Gets current cell width (grid width / # of columns).
-### `commit()`
-
-Ends batch updates. Updates DOM nodes. You must call it after `batchUpdate()`.
-
### `column(column: number, layout: ColumnOptions = 'moveScale')`
set the number of columns in the grid. Will update existing widgets to conform to new number of columns,
diff --git a/spec/e2e/html/810-many-columns.html b/spec/e2e/html/810-many-columns.html
index 1c1c89c18..b22acb152 100644
--- a/spec/e2e/html/810-many-columns.html
+++ b/spec/e2e/html/810-many-columns.html
@@ -38,7 +38,7 @@ Many Columns demo
for (; count <= COLUMNS;) {
this.addNewWidget();
}
- grid.commit();
+ grid.batchUpdate(false);