Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't set isDirty to true in diff callbacks #9765

Merged
merged 2 commits into from
Mar 13, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -226,7 +226,6 @@ function replaceRelatedRecordsRemote(graph: Graph, op: ReplaceRelatedRecordsOper
);
}
}
relationship.isDirty = true;
}
addToInverse(graph, identifier, definition.inverseKey, op.record, isRemote);
},
@@ -245,7 +244,6 @@ function replaceRelatedRecordsRemote(graph: Graph, op: ReplaceRelatedRecordsOper
);
}
}
relationship.isDirty = true;
}
removeFromInverse(graph, identifier, definition.inverseKey, op.record, isRemote);
}
@@ -273,7 +271,8 @@ function replaceRelatedRecordsRemote(graph: Graph, op: ReplaceRelatedRecordsOper
// because we want to clear local changes even if
// no change has occurred to preserve the legacy behavior
relationship.definition.kind === 'hasMany' &&
relationship.definition.resetOnRemoteUpdate !== false
relationship.definition.resetOnRemoteUpdate !== false &&
(diff.changed || wasDirty)
) {
const deprecationInfo: {
removals: StableRecordIdentifier[];
Original file line number Diff line number Diff line change
@@ -747,7 +747,7 @@ module('Integration | Graph | Diff Preservation', function (hooks) {
class App extends Model {
@attr declare name: string;
@hasMany('config', { async: false, inverse: 'app' }) declare configs: Config[];
@hasMany('namespace', { async: false, inverse: 'apps' }) declare namespaces: Namespace | null;
@hasMany('namespace', { async: false, inverse: 'apps' }) declare namespaces: Namespace[];
}

class Namespace extends Model {
@@ -777,7 +777,7 @@ module('Integration | Graph | Diff Preservation', function (hooks) {
// each namespace has the app and 2 more apps
store._join(() => {
// setup primary app relationships
// this also convers the belongsTo side on config
// this also converts the belongsTo side on config
graph.push({
op: 'updateRelationship',
field: 'configs',
@@ -842,7 +842,7 @@ module('Integration | Graph | Diff Preservation', function (hooks) {
// for app:1
store._join(() => {
// setup primary app relationships
// this also convers the belongsTo side on config
// this also converts the belongsTo side on config
graph.push({
op: 'updateRelationship',
field: 'configs',
5 changes: 3 additions & 2 deletions tests/ember-data__graph/tests/test-helper.ts
Original file line number Diff line number Diff line change
@@ -4,6 +4,7 @@ import Application from 'ember-data__graph/app';
import config from 'ember-data__graph/config/environment';

import configureAsserts from '@ember-data/unpublished-test-infra/test-support/asserts/index';
import { IS_CI } from '@warp-drive/build-config/env';
import { setupGlobalHooks } from '@warp-drive/diagnostic';
import { configure } from '@warp-drive/diagnostic/ember';
import { start } from '@warp-drive/diagnostic/runners/dom';
@@ -17,9 +18,9 @@ configure();
setApplication(Application.create(config.APP));
void start({
tryCatch: false,
debug: false,
debug: IS_CI ? false : true,
groupLogs: false,
instrument: true,
hideReport: true,
hideReport: IS_CI ? true : false,
useDiagnostic: true,
});
Loading