Skip to content

Commit

Permalink
refactor: remove deprecation ember-data:no-a-with-array-like
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredgalanis committed May 27, 2024
1 parent 85d88dc commit 9571e20
Show file tree
Hide file tree
Showing 14 changed files with 24 additions and 37 deletions.
9 changes: 4 additions & 5 deletions app/components/found-manuscripts/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';
import { inject as service } from '@ember/service';
import { A } from '@ember/array';
import { task } from 'ember-concurrency-decorators';
import { action, get, set } from '@ember/object';

Expand All @@ -11,8 +10,8 @@ export default class FoundManuscriptsComponent extends Component {
@service store;
@service appStaticConfig;

@tracked foundManuscripts = A([]);
@tracked manuscriptsWithErrors = A([]);
@tracked foundManuscripts = [];
@tracked manuscriptsWithErrors = [];
@tracked selectedManuscript = null;
@tracked contactUrl;

Expand All @@ -24,8 +23,8 @@ export default class FoundManuscriptsComponent extends Component {
}

get foundManuscriptsToDisplay() {
let prevFiles = this.args.previouslyUploadedFiles || A([]);
let newFiles = this.args.newFiles || A([]);
let prevFiles = this.args.previouslyUploadedFiles || [];
let newFiles = this.args.newFiles || [];

const allFileNames = [...newFiles.toArray(), ...prevFiles.toArray()].map((file) => file.name);

Expand Down
3 changes: 1 addition & 2 deletions app/components/submissions-repoid-cell/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';
import { action, get, set } from '@ember/object';
import { inject as service } from '@ember/service';
import { A } from '@ember/array';

export default class SubmissionsRepoidCell extends Component {
@service store;
Expand All @@ -17,7 +16,7 @@ export default class SubmissionsRepoidCell extends Component {
const publicationId = get(this, 'args.record.publication.id');
if (!publicationId) {
if (!(get(this, 'isDestroyed') || get(this, 'isDestroying'))) {
set(this, 'repoCopies', A());
set(this, 'repoCopies', []);
return;
}
}
Expand Down
9 changes: 4 additions & 5 deletions app/components/workflow-basics/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { tracked } from '@glimmer/tracking';
import { action, get, set } from '@ember/object';
import { alias } from '@ember/object/computed';
import { inject as service } from '@ember/service';
import { A } from '@ember/array';
import { task, timeout } from 'ember-concurrency';
import { scheduleOnce } from '@ember/runloop';
import { dropTask } from 'ember-concurrency-decorators';
Expand Down Expand Up @@ -207,7 +206,7 @@ export default class WorkflowBasics extends Component {
});

if (result.value) {
set(this, 'submission.grants', A());
set(this, 'submission.grants', []);
this.updateSubmitterModel(isProxySubmission, submitter);

this.flashMessages.info('Submitter and related grants removed from submission.');
Expand All @@ -224,10 +223,10 @@ export default class WorkflowBasics extends Component {
this.submission.submitterName = '';
if (isProxySubmission) {
this.submission.submitter = submitter;
this.submission.preparers = A([get(this, 'currentUser.user')]);
this.submission.preparers = [this.currentUser.user];
} else {
this.submission.submitter = get(this, 'currentUser.user');
this.submission.preparers = A();
this.submission.submitter = this.currentUser.user;
this.submission.preparers = [];
}
}

Expand Down
9 changes: 4 additions & 5 deletions app/components/workflow-files/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import Component from '@glimmer/component';
import { action, get, set, computed } from '@ember/object';
import { inject as service } from '@ember/service';
import { A } from '@ember/array';
import { task } from 'ember-concurrency-decorators';
import ENV from 'pass-ui/config/environment';

Expand All @@ -20,8 +19,8 @@ export default class WorkflowFiles extends Component {

@computed('args.newFiles.[]', 'previouslyUploadedFiles.[]')
get manuscript() {
const newFiles = get(this, 'args.newFiles') || A([]);
const prevFiles = get(this, 'args.previouslyUploadedFiles') || A([]);
const newFiles = get(this, 'args.newFiles') || [];
const prevFiles = get(this, 'args.previouslyUploadedFiles') || [];

return [...prevFiles.toArray(), ...newFiles.toArray()].find((file) => file.fileRole === 'manuscript');
}
Expand All @@ -31,8 +30,8 @@ export default class WorkflowFiles extends Component {
*/
@computed('args.newFiles.[]', 'previouslyUploadedFiles.[]')
get supplementalFiles() {
const newFiles = get(this, 'args.newFiles') || A([]);
const prevFiles = get(this, 'args.previouslyUploadedFiles') || A([]);
const newFiles = get(this, 'args.newFiles') || [];
const prevFiles = get(this, 'args.previouslyUploadedFiles') || [];

return [...prevFiles.toArray(), ...newFiles.toArray()].filter((file) => file.fileRole !== 'manuscript');
}
Expand Down
3 changes: 1 addition & 2 deletions app/components/workflow-grants/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';
import { action, get, set } from '@ember/object';
import { A } from '@ember/array';
import { inject as service } from '@ember/service';
import { task } from 'ember-concurrency';

Expand All @@ -28,7 +27,7 @@ export default class WorkflowGrants extends Component {
@tracked submitterGrants = null;
@tracked totalGrants = 0;
/** Grants already attached to the submission on component init */
@tracked _selectedGrants = A();
@tracked _selectedGrants = [];
@tracked preLoadedGrant = this.args.preLoadedGrant;
@tracked grantColumns = [
{
Expand Down
3 changes: 1 addition & 2 deletions app/components/workflow-repositories/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';
import { action, get, set } from '@ember/object';
import { A } from '@ember/array';
import { inject as service } from '@ember/service';

/**
Expand Down Expand Up @@ -37,7 +36,7 @@ export default class WorkflowRepositories extends Component {
@service submissionHandler;
@service workflow;

@tracked addedRepos = A([]);
@tracked addedRepos = [];

// Separate out repositories that PASS has some level of integration
get requiredIntegratedRepos() {
Expand Down
5 changes: 2 additions & 3 deletions app/components/workflow-review/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';
import { action, get, set } from '@ember/object';
import { A } from '@ember/array';
import { inject as service } from '@ember/service';
import { task } from 'ember-concurrency-decorators';
import { later } from '@ember/runloop';
Expand All @@ -23,12 +22,12 @@ export default class WorkflowReview extends Component {
@service currentUser;
@service flashMessages;

@tracked isValidated = A();
@tracked isValidated = [];
@tracked filesTemp = this.workflow.filesTemp;
@tracked hasVisitedWeblink = false;

get parsedFiles() {
let newArr = A();
let newArr = [];
if (this.filesTemp) {
newArr.addObjects(this.filesTemp);
}
Expand Down
3 changes: 1 addition & 2 deletions app/controllers/grants/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-disable ember/classic-decorator-no-classic-methods */
import { A } from '@ember/array';
import Controller from '@ember/controller';
import { action } from '@ember/object';
import { tracked } from '@glimmer/tracking';
Expand Down Expand Up @@ -185,7 +184,7 @@ export default class GrantsIndexController extends Controller {
const meta = data.meta;
let results = data.map((grant) => ({
grant,
submissions: A(),
submissions: [],
}));

return {
Expand Down
3 changes: 1 addition & 2 deletions app/controllers/submissions/new.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* eslint-disable ember/no-get, ember/classic-decorator-no-classic-methods */
import Controller from '@ember/controller';
import { tracked } from '@glimmer/tracking';
import { A } from '@ember/array';
import { action, get, set } from '@ember/object';
import { inject as service } from '@ember/service';

Expand Down Expand Up @@ -105,7 +104,7 @@ export default class SubmissionsNew extends Controller {
.then(() => {
set(this, 'uploading', false);
set(this, 'comment', '');
set(this, 'workflow.filesTemp', A());
set(this, 'workflow.filesTemp', []);
this.router.transitionTo('thanks', { queryParams: { submission: get(sub, 'id') } });
})
.catch((error) => {
Expand Down
3 changes: 1 addition & 2 deletions app/controllers/submissions/new/basics.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import Controller, { inject as controller } from '@ember/controller';
import { tracked } from '@glimmer/tracking';
import { action, computed, get, set } from '@ember/object';
import { A } from '@ember/array';
import { alias } from '@ember/object/computed';
import { inject as service } from '@ember/service';
import { task } from 'ember-concurrency-decorators';
Expand All @@ -26,7 +25,7 @@ export default class SubmissionsNewBasics extends Controller {
@tracked submitterEmailError = false;

get flaggedFields() {
let fields = A();
let fields = [];
if (this.titleError) fields.pushObject('title');
if (this.journalError) fields.pushObject('journal');
if (this.submitterEmailError) fields.pushObject('submitterEmail');
Expand Down
1 change: 0 additions & 1 deletion app/deprecation-workflow.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@ setupDeprecationWorkflow({
workflow: [
{ handler: 'silence', matchId: 'ember-data:deprecate-promise-many-array-behaviors' },
{ handler: 'silence', matchId: 'ember-data:deprecate-array-like' },
{ handler: 'silence', matchId: 'ember-data:no-a-with-array-like' },
],
});
3 changes: 1 addition & 2 deletions app/routes/grants/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { service } from '@ember/service';
import { A } from '@ember/array';
import CheckSessionRoute from '../check-session-route';
import { grantsIndexGrantQuery, grantsIndexSubmissionQuery } from '../../util/paginated-query';

Expand Down Expand Up @@ -44,7 +43,7 @@ export default class IndexRoute extends CheckSessionRoute {
grants.forEach((grant) => {
results.grantMap.push({
grant,
submissions: A(),
submissions: [],
});
});

Expand Down
4 changes: 2 additions & 2 deletions app/services/submission-handler.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable ember/no-get */
import { A, isArray } from '@ember/array';
import { isArray } from '@ember/array';
import Service, { inject as service } from '@ember/service';
import ENV from 'pass-ui/config/environment';
import { task } from 'ember-concurrency-decorators';
Expand All @@ -22,7 +22,7 @@ export default class SubmissionHandlerService extends Service {
* @returns EmberArray with repositories
*/
getRepositoriesFromGrants(grants) {
let result = A();
let result = [];

grants.forEach((grant) => {
const directRepos = grant.get('directFunder.policy.repositories');
Expand Down
3 changes: 1 addition & 2 deletions app/services/workflow.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-disable ember/classic-decorator-no-classic-methods */
import { A } from '@ember/array';
import Service from '@ember/service';
import { tracked } from '@glimmer/tracking';

Expand All @@ -20,7 +19,7 @@ export default class Workflow extends Service {
@tracked filesTemp = [];
@tracked defaultRepoLoaded = false; // you only want to load the default setting on first access, after that is should respect he user's choice.

@tracked addedGrants = A([]);
@tracked addedGrants = [];

resetWorkflow() {
this.setCurrentStep(0);
Expand Down

0 comments on commit 9571e20

Please sign in to comment.