Skip to content
Open
Show file tree
Hide file tree
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
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@
"fireworm>async": "^2.6.4",
"ember-cli-babel>@babel/runtime": "7.27.6",
"ember-try-config>package-json": "^10.0.1",
"ember-stargate@^0.6.0>@glimmer/component": "^2.0.0"
"ember-stargate@^0.6.0>@glimmer/component": "^2.0.0",
"ember-loading>ember-concurrency": "^4.0.0"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this needed? It looks like you changed the ember-loading package.json to instead make ember-concurrency a peer dep, would it not just load our app's version now?

Copy link
Collaborator Author

@hashicc hashicc Oct 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Patching the dependency's package.json doesn't actually change what gets installed so the manual overrides to ember-concurrency v4 is also needed.

I treated the patch as what the package output should be, but unfortunately the way the patches are resolved don't impact how the dependencies are managed and stored in the lockfile. Aside from changing the version I wanted to hint at that ember-concurrency-async and ember-concurrency-ts shouldn't be used, but those are also in the lockfile still. If this is more confusing than helpful I can remove the dependency changes from the package.json patch

},
"ignoredBuiltDependencies": [
"@parcel/watcher",
Expand All @@ -63,7 +64,10 @@
"@nestjs/core",
"@openapitools/openapi-generator-cli"
],
"onlyBuiltDependencies": []
"onlyBuiltDependencies": [],
"patchedDependencies": {
"ember-loading": "patches/ember-loading.patch"
}
},
"config": {
"commitizen": {
Expand Down
112 changes: 112 additions & 0 deletions patches/ember-loading.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
diff --git a/addon/services/loading.ts b/addon/services/loading.ts
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

index 34ac7eb0cdf4ee8f09661ba2459068307bb2792e..9d201c99046fb2e3d6ba3b49f8c1445a4c768c02 100644
--- a/addon/services/loading.ts
+++ b/addon/services/loading.ts
@@ -4,7 +4,6 @@ import { restartableTask, task, timeout } from 'ember-concurrency';
import RouterService from '@ember/routing/router-service';
import { getOwner } from '@ember/application';
import RSVP, { defer } from 'rsvp';
-import { taskFor } from 'ember-concurrency-ts';

type ParseArgsValue = [any, Function, any[] | undefined];

@@ -49,7 +48,6 @@ function parseArgs(): ParseArgsValue {
}

export default class LoadingService extends Service {
-
@service
router!: RouterService;

@@ -58,11 +56,11 @@ export default class LoadingService extends Service {
watchTransitions = true;

get isLoading(): boolean {
- return taskFor(this._runJob).isRunning;
+ return this._runJob.isRunning;
}

get showLoading(): boolean {
- return !taskFor(this.preDelayTask).isRunning && (this.isLoading || taskFor(this.postDelayTask).isRunning);
+ return !this.preDelayTask.isRunning && (this.isLoading || this.postDelayTask.isRunning);
}

_routerTransitionDeferred?: RSVP.Deferred<unknown>;
@@ -132,33 +130,30 @@ export default class LoadingService extends Service {
// run<R>(fn: () => R): Promise<R>;
async run(...args: any[]) {
if (this.preDelay > 0) {
- taskFor(this.preDelayTask).perform(this.preDelay);
+ this.preDelayTask.perform(this.preDelay);
}

- let result = await taskFor(this._runJob).perform(...args);
+ let result = await this._runJob.perform(...args);

if (this.postDelay > 0) {
- taskFor(this.postDelayTask).perform(this.postDelay);
+ this.postDelayTask.perform(this.postDelay);
}

return result;
}

- @task
- async _runJob(...args: unknown[]): Promise<unknown> {
+ _runJob = task(async (...args: unknown[]) => {
let [target, method, realArgs] = parseArgs(...args);
return await method.apply(target, realArgs);
- }
+ });

- @restartableTask
- async preDelayTask(delay: number): Promise<void> {
+ preDelayTask = restartableTask(async (delay: number) => {
await timeout(delay);
- }
+ });

- @restartableTask
- async postDelayTask(delay: number): Promise<void> {
+ postDelayTask = restartableTask(async (delay: number) => {
await timeout(delay);
- }
+ });
}

// DO NOT DELETE: this is how TypeScript knows how to look up your services.
diff --git a/index.js b/index.js
index 0ca063d427d9441b9b3a1274bfcfe47186623c63..ca80a9382c6f5e64504048e0757215b1272fb849 100644
--- a/index.js
+++ b/index.js
@@ -2,4 +2,11 @@

module.exports = {
name: require('./package').name,
+ options: {
+ babel: {
+ plugins: [
+ require.resolve('ember-concurrency/async-arrow-task-transform'),
+ ],
+ },
+ },
};
Comment on lines +84 to +93
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

diff --git a/package.json b/package.json
index 3b898dce9a160776192437af4c35b2038eb39232..2a37d3d6f179bfe62479c5141d705a2d3e4eeaeb 100644
--- a/package.json
+++ b/package.json
@@ -31,10 +31,10 @@
"dependencies": {
"ember-cli-babel": "^7.26.6",
"ember-cli-htmlbars": "^5.7.1",
- "ember-cli-typescript": "^4.1.0",
- "ember-concurrency": "^2.0.3",
- "ember-concurrency-async": "^1.0.0",
- "ember-concurrency-ts": "^0.3.0"
+ "ember-cli-typescript": "^4.1.0"
+ },
+ "peerDependencies": {
+ "ember-concurrency": "^4.0.0"
},
"devDependencies": {
"@ember/optional-features": "2.0.0",
56 changes: 16 additions & 40 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.