Skip to content

fix(sanity): live preview service is called before be initialized#9

Merged
osnoser1 merged 1 commit into
mainfrom
bugfix/live-preview-service-initialization
Feb 10, 2025
Merged

fix(sanity): live preview service is called before be initialized#9
osnoser1 merged 1 commit into
mainfrom
bugfix/live-preview-service-initialization

Conversation

@osnoser1

Copy link
Copy Markdown
Member

PR Checklist

What is the new behavior?

This PR fixes a timing issue with the LivePreviewService initialization. Previously, the service was initialized using afterNextRender(), which could potentially cause race conditions or initialization delays. The change replaces this with Angular's effect(), ensuring that:

  1. The initialization happens reactively when the token input is available
  2. The service is properly initialized before any live preview functionality is used
  3. The initialization will re-run if the token changes

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

The change from afterNextRender to effect is a more idiomatic way to handle reactive initialization in Angular's signals-based architecture. This ensures better predictability of when the live preview service is initialized and maintains reactivity with the token input.

What gif best describes this PR or how it makes you feel?

[A "Perfect Timing" gif would be appropriate here since this PR fixes a timing-related issue]

@netlify

netlify Bot commented Feb 10, 2025

Copy link
Copy Markdown

Deploy Preview for limitless-angular-sanity-example ready!

Name Link
🔨 Latest commit b6059d9
🔍 Latest deploy log https://app.netlify.com/sites/limitless-angular-sanity-example/deploys/67a9668140d27400080bf67d
😎 Deploy Preview https://deploy-preview-9--limitless-angular-sanity-example.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@nx-cloud

nx-cloud Bot commented Feb 10, 2025

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit b6059d9.

Command Status Duration Result
nx affected -t lint build ✅ Succeeded 1m 26s View ↗

☁️ Nx Cloud last updated this comment at 2025-02-10 02:39:50 UTC

@osnoser1 osnoser1 merged commit 22a3e90 into main Feb 10, 2025
@osnoser1 osnoser1 deleted the bugfix/live-preview-service-initialization branch February 10, 2025 03:01
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

Successfully merging this pull request may close these issues.

1 participant