Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IDEA] Configuration inconsistencies, init process consolidation #321

Open
hakenr opened this issue Sep 24, 2024 · 0 comments
Open

[IDEA] Configuration inconsistencies, init process consolidation #321

hakenr opened this issue Sep 24, 2024 · 0 comments

Comments

@hakenr
Copy link
Contributor

hakenr commented Sep 24, 2024

Let's assume IsWasmStandalone="false" (the default).

Currently, the configuration is expected to be provided through pre-rendering (the ApplicationInsightsInit component emits the script tag with the configuration included). However, the instructions and samples still direct you to provide the connection string in the .Client project as well. The connection string provided to the client is not used unless you manually call AppInsights.UpdateCfg().

This should be consolidated.

My proposal:

  1. Provide the script with the initial configuration from the server if static server-side rendering/pre-rendering occurs.
  2. Modify the script to prevent multiple loads (see this example for inspiration). This change would allow removing the if (!IsWasmStandalone) check from ApplicationInsightsInit.razor and enable it to always initialize.
  3. In ApplicationInsightsInit.razor.cs:OnAfterRender(), under firstRender call UpdateCfg() with merging logic to preserve the server-rendered connection string, ensuring it's not overwritten on the client side, where a duplicate connection string configuration won't be needed.

cc @jirikanda

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant