diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1dfe1e05f3c..75dc9cac4e4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -73,6 +73,8 @@ jobs: steps: - uses: actions/checkout@v4 - uses: ./.github/actions/setup + - name: rollup + run: pnpm build - name: build run: pnpm vite build --mode=development - name: test @@ -104,6 +106,8 @@ jobs: steps: - uses: actions/checkout@v4 - uses: ./.github/actions/setup + - name: rollup + run: pnpm build - name: build run: pnpm vite build --mode=${{ matrix.BUILD || 'development' }} - name: test diff --git a/packages/@ember/-internals/glimmer/tests/integration/application/rendering-test.js b/packages/@ember/-internals/glimmer/tests/integration/application/rendering-test.js index 3e32631ff08..d7563ea26da 100644 --- a/packages/@ember/-internals/glimmer/tests/integration/application/rendering-test.js +++ b/packages/@ember/-internals/glimmer/tests/integration/application/rendering-test.js @@ -6,6 +6,7 @@ import { service } from '@ember/service'; import { Component } from '@ember/-internals/glimmer'; import { tracked } from '@ember/-internals/metal'; import { set } from '@ember/object'; +import GlimmerComponent from '@glimmer/component'; import { backtrackingMessageFor } from '../../utils/debug-stack'; import { runTask } from '../../../../../../internal-test-helpers/lib/run'; import { template } from '@ember/template-compiler'; @@ -398,6 +399,98 @@ moduleFor( }); } + async ['@test @model should be stable when transitioning out of the route']() { + let assert = this.assert; + + this.router.map(function () { + this.route('a', function () { + this.route('b'); + this.route('c'); + }); + this.route('d', function () { + this.route('e'); + }); + this.route('f'); + }); + + this.addComponent('foo', { + ComponentClass: class extends GlimmerComponent { + willDestroy() { + assert.step(this.args.model); + } + }, + }); + this.add( + 'route:a', + class extends Route { + model() { + return 'a'; + } + } + ); + this.add( + 'route:a.b', + class extends Route { + model() { + return 'b'; + } + } + ); + this.addTemplate('a.b', ''); + this.add( + 'route:a.c', + class extends Route { + model() { + return 'c'; + } + } + ); + this.add( + 'route:d', + class extends Route { + model() { + return 'd'; + } + } + ); + this.add( + 'route:d.e', + class extends Route { + model() { + return 'e'; + } + } + ); + this.add( + 'route:f', + class extends Route { + model() { + return 'f'; + } + } + ); + + await this.visit('/a/b'); + await this.visit('/a'); + + await this.visit('/a/b'); + await this.visit('/a/c'); + + await this.visit('/a/b'); + await this.visit('/d'); + + await this.visit('/a/b'); + await this.visit('/d/e'); + + await this.visit('/a/b'); + await this.visit('/f'); + + this.assert.verifySteps( + ['b', 'b', 'b', 'b', 'b'], + 'The @model property of the Foo component should be stable in the willDestroy hook' + ); + } + ['@test it should produce a stable DOM when the model changes']() { this.router.map(function () { this.route('color', { path: '/colors/:color' }); diff --git a/vite.config.mjs b/vite.config.mjs index 8fa253626f1..59f2aec49f6 100644 --- a/vite.config.mjs +++ b/vite.config.mjs @@ -40,6 +40,14 @@ export default defineConfig(({ mode }) => { viteResolverBug(), version(), ], + resolve: { + alias: { + '@glimmer/component': resolve( + dirname(fileURLToPath(import.meta.url)), + './packages/@glimmer/component/dist/index.js' + ), + }, + }, optimizeDeps: { noDiscovery: true }, publicDir: 'tests/public', build,