feat: skip useInaliaQuestion fetches when Inalia is in static mode#44
Conversation
Agent-Logs-Url: https://github.com/Inalia-App/slidev-addon-inalia/sessions/e171bc80-8b66-4840-af6f-40694a85f269 Co-authored-by: Barbapapazes <45267552+Barbapapazes@users.noreply.github.com>
useInaliaQuestion fetches when Inalia is in static mode
|
waiting for #45 for a proper implementation. |
useInaliaQuestion fetches when Inalia is in static modeuseInaliaQuestion fetches when Inalia is in static mode
Barbapapazes
left a comment
There was a problem hiding this comment.
use comments and update tests.
| export function useInaliaQuestion(defaultQuestionId: MaybeRefOrGetter<number | undefined>, options?: UseInaliaQuestionOptions): Inalia { | ||
| const { staticContent } = options || {} | ||
|
|
||
| const talk = inject<Talk | null>('talk', null) |
There was a problem hiding this comment.
Use the new useInaliaStatus, instead of manually injecting the talk.
There was a problem hiding this comment.
Updated in 918e206 to use useInaliaStatus() in useInaliaQuestion, and revalidated the composable/tests.
commit: |
There was a problem hiding this comment.
Pull request overview
This PR prevents useInaliaQuestion from attempting dynamic question fetching (and related real-time subscriptions) when the addon is effectively in “static mode” because no talk is available via injection.
Changes:
- Inject
talkintouseInaliaQuestionand short-circuit fetch logic on mount, onquestionIdchanges, and insidefetch()whentalkisnull. - Extend the composable test harness to provide a default
talk(to preserve existing dynamic-path tests) and add a regression test fortalk: null.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| composables/useInaliaQuestion.ts | Adds injected talk gating to skip fetch/subscription work when talk is unavailable. |
| tests/composables/useInaliaQuestion.spec.ts | Provides talk via test mounting and adds coverage ensuring no fetch/Echo subscription when talk is null. |
Agent-Logs-Url: https://github.com/Inalia-App/slidev-addon-inalia/sessions/8d59cbea-8697-445f-9ae8-df41e2599bcb Co-authored-by: Barbapapazes <45267552+Barbapapazes@users.noreply.github.com>
Addressed in |
useInaliaQuestionchanges, and the newuseInaliaStatuscomposable to determine the minimal update.useInaliaQuestionto rely onuseInaliaStatusinstead of manually injecting talk state.