-
Couldn't load subscription status.
- Fork 10
1049 bug no events triggered before gameplay despite video start #1083
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
base: main
Are you sure you want to change the base?
1049 bug no events triggered before gameplay despite video start #1083
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR addresses bug #1049 by refactoring storage implementation and adding an initialization event to track when the application starts. The changes replace local storage with cookie-based storage for device ID management and ensure events are properly triggered at application startup.
- Replaced LocalStorage implementation with Cookie-based Storage for persistent device ID management
- Added an
init_eventfunction to track application initialization with user principal data - Enhanced logging for debugging Mixpanel event flow
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| ssr/src/utils/src/storage.rs | New cookie-based storage implementation replacing local storage |
| ssr/src/utils/src/mixpanel/mixpanel_events.rs | Added init_event function and updated device ID references |
| ssr/src/utils/src/local_storage.rs | Removed local storage implementation |
| ssr/src/utils/src/lib.rs | Updated module exports to use storage instead of local_storage |
| ssr/src/page/src/root.rs | Added init_event call on page load with user principal |
| ssr/src/page/src/post_view/mod.rs | Changed Effect to Effect::new_isomorphic for better SSR compatibility |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| if let Some(uuid) = uuid_value { | ||
| uuid |
Copilot
AI
Aug 26, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function logic is inconsistent with the removed LocalStorage implementation. The original code checked uuid_value.is_empty() for an empty string, but this code checks for None. This could cause issues if cookies return empty strings instead of None, leading to unnecessary UUID regeneration.
| if let Some(uuid) = uuid_value { | |
| uuid | |
| if let Some(ref uuid) = uuid_value { | |
| if !uuid.is_empty() { | |
| uuid.clone() | |
| } else { | |
| let new_device_id = uuid::Uuid::new_v4().to_string(); | |
| set_uuid.set(Some(new_device_id.clone())); | |
| new_device_id | |
| } |
| } | ||
|
|
||
| pub async fn init_event(user_principal: Option<String>) { | ||
| leptos::logging::log!("Init event {:?})", user_principal); |
Copilot
AI
Aug 26, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing closing quote in the log message format string. It should be "Init event {:?})" → "Init event {:?}".
| leptos::logging::log!("Init event {:?})", user_principal); | |
| leptos::logging::log!("Init event {:?}", user_principal); |
|
|
||
| #[server] | ||
| async fn track_event_server_fn(props: Value) -> Result<(), ServerFnError> { | ||
| leptos::logging::log!("Init event served"); |
Copilot
AI
Aug 26, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This debug log message is misleading as it appears in the general track_event_server_fn function, not specifically for init events. This will log for all events tracked through this function, which could be confusing when debugging.
| leptos::logging::log!("Init event served"); | |
| leptos::logging::log!("Event tracked via track_event_server_fn"); |
No description provided.