Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 778885b

Browse files
committed
feat: add option to turn off mdate updates
1 parent d58504e commit 778885b

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

packages/nymph/src/conf/d.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@ export interface Config {
2121
* return a 404 error.
2222
*/
2323
emptyListError: boolean;
24+
/**
25+
* Whether to update the mdate property when saving an entity.
26+
*
27+
* You should probably only set this to false if you're doing migrations. Some
28+
* things depend on having updated mdates (like conflict detection to avoid
29+
* lost updates).
30+
*/
31+
updateMDate: boolean;
2432
/**
2533
* A function to log info messages. By default, uses the `debug` package.
2634
*/

packages/nymph/src/conf/defaults.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export default {
2828
cacheThreshold: 4,
2929
cacheLimit: 50,
3030
emptyListError: false,
31+
updateMDate: true,
3132
debugInfo: (source, message) => {
3233
getDebuggers(source).info(message);
3334
},

packages/nymph/src/driver/NymphDriver.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1038,7 +1038,9 @@ export default abstract class NymphDriver {
10381038
| null = null,
10391039
) {
10401040
// Get a modified date.
1041-
const mdate = Date.now();
1041+
const mdate = this.nymph.config.updateMDate
1042+
? Date.now()
1043+
: (entity.mdate ?? Date.now());
10421044
const tags = difference(entity.tags, ['']);
10431045
const data = entity.$getData();
10441046
const sdata = entity.$getSData();

0 commit comments

Comments
 (0)