Update angular to v18 (major) #427
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
11.2.14->18.2.0^11.2.15->^18.2.0^11.2.14->^18.2.011.2.14->18.2.0^11.2.14->^18.2.0^11.2.14->^18.2.0^11.2.14->^18.2.0^11.2.14->^18.2.0^11.2.14->^18.2.0^11.2.14->^18.2.0^11.2.14->^18.2.0^11.2.14->^18.2.0Release Notes
angular/angular (@angular/animations)
v18.2.0Compare Source
Breaking Changes
zone.js
fakeAsyncwill now flush pending timers at the end ofthe given function by default. To opt-out of this, you can use
{flush: false}in options parameter offakeAsynccompiler
compiler-cli
interpolatedSignalNotInvokedextended diagnostic (#57291)core
v18.1.5Compare Source
compiler-cli
core
v18.1.4Compare Source
compiler
compiler-cli
interpolatedSignalNotInvokedextended diagnostic (#57291)language-service
v18.1.3Compare Source
compiler
compiler-cli
core
v18.1.2Compare Source
compiler
compiler-cli
core
afterNextRenderhooks return that callback value. (#57031)v18.1.1Compare Source
v18.1.0Compare Source
common
compiler
compiler-cli
core
toSignal(#56447)ComponentMirror(#56402)afterRender&afterNextRenderphases API (#55648)forms
NgControlStatushost bindingsOnPushcompatible (#55720)http
Content-Typeheader case insensitive (#56541)language-service
router
UrlTreeas an input torouterLink(#56265)v18.0.7Compare Source
compiler
http
fetchoutside of Angular zone (#56820)migrations
v18.0.6Compare Source
common
core
router
v18.0.5Compare Source
core
@defererror. (#56559)v18.0.4Compare Source
compiler-cli
core
router
v18.0.3Compare Source
benchpress
core
localize
@angular/localize/initas polyfill inangular.json(#56300)migrations
v18.0.2Compare Source
core
HttpClientModuleimports on components. (#56067)withI18nSupport()call for components that use i18n blocks (#56175)migrations
v18.0.1Compare Source
compiler
compiler-cli
core
migrations
v18.0.0Compare Source
Blog post "Angular v18 is now available".
Breaking Changes
animations
matchesElementmethod has been removed fromAnimationDriveras it is unused.common
isPlatformWorkerUiandisPlatformWorkerApphave been removed without replacement, as they serve no purpose since the removal of the WebWorker platform.compiler
compiler-cli
core
OnPushviews at the root of the application need tobe marked dirty for their host bindings to refresh. Previously, the host
bindings were refreshed for all root views without respecting the
OnPushchange detection strategy.OnPushviews at the root of the application need tobe marked dirty for their host bindings to refresh. Previously, the host
bindings were refreshed for all root views without respecting the
OnPushchange detection strategy.The
ComponentFixtureautoDetectfeature will nolonger refresh the component's host view when the component is
OnPushand not marked dirty. This exposes existing issues in components which
claim to be
OnPushbut do not correctly callmarkForCheckwhen theyneed to be refreshed. If this change causes test failures, the easiest
fix is to change the component to
ChangeDetectionStrategy.Default.ComponentFixture.whenStablenow matches theApplicationRef.isStableobservable. Prior to this change, stabilityof the fixture did not include everything that was considered in
ApplicationRef.whenStableof the fixture will now include unfinishedrouter navigations and unfinished
HttpClientrequests. This will causetests that
awaitthewhenStablepromise to time out when there areincomplete requests. To fix this, remove the
whenStable,instead wait for another condition, or ensure
HttpTestingControllermocks responses for all requests. Try adding
HttpTestingController.verify()before your
await fixture.whenStableto identify the open requests.Also, make sure your tests wait for the stability promise. We found many
examples of tests that did not, meaning the expectations did not execute
within the test body.
In addition,
ComponentFixture.isStablewould synchronously switch totrue in some scenarios but will now always be asynchronous.
Angular will ensure change detection runs, even when the state update originates from
outside the zone, tests may observe additional rounds of change
detection compared to the previous behavior.
This change will be more likely to impact existing unit tests.
This should usually be seen as more correct and the test should be updated,
but in cases where it is too much effort to debug, the test can revert to the old behavior by adding
provideZoneChangeDetection({schedulingMode: NgZoneSchedulingMode.NgZoneOnly})to the
TestBedproviders.Similarly, applications which may want to update state outside the zone
and not trigger change detection can add
provideZoneChangeDetection({schedulingMode: NgZoneSchedulingMode.NgZoneOnly})to the providers in
bootstrapApplicationor addschedulingMode: NgZoneSchedulingMode.NgZoneOnlyto theBootstrapOptionsofbootstrapModule.When Angular runs change detection, it will continue to
refresh any views attached to
ApplicationRefthat are still marked forcheck after one round completes. In rare cases, this can result in infinite
loops when certain patterns continue to mark views for check using
ChangeDetectorRef.detectChanges. This will be surfaced as a runtimeerror with the
NG0103code.asynchas been removed, usewaitForAsyncinstead.The
ComponentFixture.autoDetectfeature now executeschange detection for the fixture within
ApplicationRef.tick. This moreclosely matches the behavior of how a component would refresh in
production. The order of component refresh in tests may be slightly
affected as a result, especially when dealing with additional components
attached to the application, such as dialogs. Tests sensitive to this
type of change (such as screenshot tests) may need to be updated.
Concretely, this change means that the component will refresh before
additional views attached to
ApplicationRef(i.e. dialog components).Prior to this change, the fixture component would refresh after other
views attached to the application.
The exact timing of change detection execution when
using event or run coalescing with
NgZoneis now the first of eithersetTimeoutorrequestAnimationFrame. Code which relies on thistiming (usually by accident) will need to be adjusted. If a callback
needs to execute after change detection, we recommend
afterNextRenderinstead of something like
setTimeout.Newly created and views marked for check and reattached
during change detection are now guaranteed to be refreshed in that same
change detection cycle. Previously, if they were attached at a location
in the view tree that was already checked, they would either throw
ExpressionChangedAfterItHasBeenCheckedErroror not be refreshed untilsome future round of change detection. In rare circumstances, this
correction can cause issues. We identified one instance that relied on
the previous behavior by reading a value on initialization which was
queued to be updated in a microtask instead of being available in the
current change detection round. The component only read this value during
initialization and did not read it again after the microtask updated it.
Testability methods
increasePendingRequestCount,decreasePendingRequestCountandgetPendingRequestCounthave beenremoved. This information is tracked with zones.
http
By default we now prevent caching of HTTP requests that require authorization . To opt-out from this behaviour use the
includeRequestsWithAuthHeadersoption inwithHttpTransferCache.Example:
platform-browser
StateKey,TransferStateandmakeStateKeyhave been removed from@angular/platform-browser, use the same APIs from@angular/core.platform-browser-dynamic
RESOURCE_CACHE_PROVIDERAPIs have been removed.platform-server
deprecated
platformDynamicServerhas been removed. Add animport @​angular/compilerand replace the usage withplatformServerdeprecated
ServerTransferStateModulehas been removed.TransferStatecan be use without providing this module.deprecated
useAbsoluteUrlandbaseUrlbeen removed fromPlatformConfig. Provide and absoluteurlinstead.Legacy handling or Node.js URL parsing has been removed from
ServerPlatformLocation.The main differences are;
pathnameis always suffixed with a/.portis empty whenhttp:protocol and port in url is80portis empty whenhttps:protocol and port in url is443router
RedirectCommandfor redirectsin addition to
UrlTree. Code which expects onlybooleanorUrlTreevalues in
Routetypes will need to be adjusted.Route.redirectToto be a functionin addition to the previous string. Code which expects
redirectTotoonly be a string on
Routeobjects will need to be adjusted.UrlTreeas a redirect, theredirecting navigation will now use
replaceUrlif the initialnavigation was also using the
replaceUrloption. If this is notdesirable, the redirect can configure new
NavigationBehaviorOptionsbyreturning a
RedirectCommandwith the desired options instead ofUrlTree.come from the injector heirarchy of the routes and never inherit from
the
RouterOutlet. This means that providers available only to thecomponent that defines the
RouterOutletwill no longer be available toroute components in any circumstances. This was already the case
whenever routes defined providers, either through lazy loading an
NgModuleor through explicitproviderson the route config.come from the injector heirarchy of the routes and never inherit from
the
RouterOutlet. This means that providers available only to thecomponent that defines the
RouterOutletwill no longer be available toroute components in any circumstances. This was already the case
whenever routes defined providers, either through lazy loading an
NgModuleor through explicitproviderson the route config.Deprecations
common
getCurrencySymbol,getLocaleCurrencyCode,getLocaleCurrencyName,getLocaleCurrencySymbol,getLocaleDateFormat,getLocaleDateTimeFormat,getLocaleDayNames,getLocaleDayPeriods,getLocaleDirection,getLocaleEraNames,getLocaleExtraDayPeriodRules,getLocaleExtraDayPeriods,getLocaleFirstDayOfWeek,getLocaleId,getLocaleMonthNames,getLocaleNumberFormat,getLocaleNumberSymbol,getLocalePluralCase,getLocaleTimeFormat,getLocaleWeekEndRange,getNumberOfCurrencyDigitscore
@Component.interpolationis deprecated. Use Angular'sdelimiters instead.
http
HttpClientModule,HttpClientXsrfModuleandHttpClientJsonpModuleAs mentionned, those modules can be replaced by provider function only.
animations
matchesElementfromAnimationDriver(#55479)common
isPlatformWorkerAppandisPlatformWorkerUiAPI (#55302)compiler
FatalDiagnosticError, hide themessagefield without affecting the emit (#55160)compiler-cli
@ifwith aliases (#55835)core
ApplicationRef.tickshould respect OnPush for host bindings (#53718)ApplicationRef.tickshould respect OnPush for host bindings (#53718) (#53718)ComponentFixtureautoDetectrespectsOnPushflag of host view (#54824)ComponentFixturestability should matchApplicationRef(#54949)asyncfunction (#55491)setTimeoutandrAFreferences (#55124)addEvent(#55353)Configuration
📅 Schedule: Branch creation - "after 2am and before 7am every weekday,after 2am and before 7am every weekend" in timezone Asia/Yangon, Automerge - At any time (no schedule defined).
🚦 Automerge: Enabled.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about these updates again.
This PR was generated by Mend Renovate. View the repository job log.