Skip to content

[Blazor] Backport to RC1 of Applies API review feedback and removes byte array APIs from the public API surface#35769

Merged
Pilchie merged 3 commits intorelease/6.0-rc1from
javiercn/apply-persistence-api-review-feedback-no-spanified-apis-rc1
Aug 26, 2021
Merged

[Blazor] Backport to RC1 of Applies API review feedback and removes byte array APIs from the public API surface#35769
Pilchie merged 3 commits intorelease/6.0-rc1from
javiercn/apply-persistence-api-review-feedback-no-spanified-apis-rc1

Conversation

@javiercn
Copy link
Member

@javiercn javiercn commented Aug 26, 2021

Port of #35768

Customer impact

This is a feature that we added in 6.0 to support customers that are prerendering their Blazor applications and that allows them to save state and then access it the next time the app starts after it has been prerendered.

Most changes are renaming for APIs that a customer doesn't ever interact with (because he can't extend the type nor call methods on it in a way that is useful; the APIs are public because of layering constraints between Blazor Server/Wasm and Mvc.)

This is not a core feature of the framework, so we are changing somethign that only a few folks will use (say 10% to put a number on it).

Of the APIs, the ones a customer will interact 99% of the time are below and the updates are very straighforward:

Here is a sample of the 99% use case for the feature:

-@inject ComponentApplicationState ApplicationState
+@inject PersistentComponentState ApplicationState

-        ApplicationState.OnPersisting += () +> PersistForecasts;
-        if(!ApplicationState.TryTakeAsJson<WeatherForecast[]>("fetchdata", out var restored))
+        _persistingSubscription = ApplicationState.RegisterOnPersisting(PersistForecasts);
+        if(!ApplicationState.TryTakeFromJson<WeatherForecast[]>("fetchdata", out var restored))
         {
             forecasts = await WeatherForecastService.GetForecastAsync(DateTime.Now);
         }
@@ -11,7 +11,8 @@
             forecasts = restored!;
         }
         void Dispose()
         {

-            ApplicationState.OnPersisting -= PersistForecasts;
+            _persistingSubscription.Dispose();
         }

Other renames/changes are for types that are public that customers don't directly use.

Testing

Automated. We have unit tests and E2E test coverage for all the changed APIs.

Risk

Low

  • Its a new feature included in 6.0, so it won't break existing customers on previous releases.
  • The change renames APIs.
  • Changes for customers are straighforward.
  • Its an enhancement feature used by a subset of our customers.
  • No other features build on top of this feature.

@javiercn javiercn requested review from a team, Pilchie and pranavkm as code owners August 26, 2021 12:10
@Pilchie Pilchie added the Servicing-consider Shiproom approval is required for the issue label Aug 26, 2021
@ghost
Copy link

ghost commented Aug 26, 2021

Hello human! Please make sure you've included the Shiproom Template in a comment or (preferably) the PR description. Also, make sure this PR is not marked as a draft and is ready-to-merge.

Copy link
Contributor

@pranavkm pranavkm left a comment

Choose a reason for hiding this comment

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

Same comments as #35768

@danmoseley danmoseley changed the title [Blazor] Backport of https://github.com/dotnet/aspnetcore/pull/35768 to RC1 [Blazor] Backport to RC1 of Applies API review feedback and removes byte array APIs from the public API surface Aug 26, 2021
@leecow leecow added Servicing-approved Shiproom has approved the issue and removed Servicing-consider Shiproom approval is required for the issue labels Aug 26, 2021
@Pilchie Pilchie added Servicing-approved Shiproom has approved the issue and removed Servicing-approved Shiproom has approved the issue labels Aug 26, 2021
@Pilchie
Copy link
Member

Pilchie commented Aug 26, 2021

@javiercn - this is approved. Do you want to apply @pranavkm's feedback from above, or do you want me to merge now?

@javiercn
Copy link
Member Author

@Pilchie let's merge it now. I'll apply the feedback on main, since they are style comments

@Pilchie Pilchie merged commit 8a67fca into release/6.0-rc1 Aug 26, 2021
@Pilchie Pilchie deleted the javiercn/apply-persistence-api-review-feedback-no-spanified-apis-rc1 branch August 26, 2021 18:07
@ghost ghost added this to the 6.0-rc1 milestone Aug 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Servicing-approved Shiproom has approved the issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants