Skip to content

[BUG] setLanguage from useSessionContext is not working #2316

@karladler

Description

@karladler

Problem description and current behaviour

Using setLanguage the languageId is not updated.

Context

  • calling setLanguage() fires indeed a http request with the correct language id in payload:
    • {"languageId":"LANGUAGE_ID"}
  • The refreshContext() is correctly fetching the context again
    • But in the context response is still the old language id

      "context": { ... "languageIdChain": ["OLD_lANGUAGE_ID"] ... }

Expected Behavior

Changing the language should update languageId in the component.

Steps To Reproduce

Minimal code for reproduction, anywhere in a Nuxt project:

<script setup lang="ts">
    const { languageId, setLanguage } = useSessionContext();
</script>

<template>
     {{languageId}}

      <button @click="setLanguage({ id: 'ENGLISH_ID' })">
            Change to English
        </button>
        <button @click="setLanguage({ id: 'GERMAN_ID' })">
            Change to German
        </button>
</template>

Anything else?

I am not sure if this is an composables problem or an actual core error.

Metadata

Metadata

Labels

No labels
No labels

Type

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions