W
W
WebDev2018-12-20 10:20:01
Vue.js
WebDev, 2018-12-20 10:20:01

bug in nuxt on server?

We put the application in production and one user has an error

[nuxt] Error while initializing app DOMException: Failed to execute 'appendChild' on 'Node': This node type does not support this method.

Nothing strange was found in the code and by typing I found the reason:
<div class="form-block" v-if="$store.state.language === 'ru'">
    <label>Zip code *</label>
</div>

The v-if="$store.state.language=== 'ru'" construct causes an error.
In vuex:
...
        state: () => ({
            language: 'en',
        }),
        actions: {
            nuxtServerInit ({ commit }, { req }) {
                let language = 'en';

                if (req.headers['accept-language']) {
                    if (req.headers['accept-language'].toLowerCase().indexOf('ru') > -1) {
                        language = 'ru';
                    }
                }

                commit('setLanguage', language);
            }
        }

That is, the language is defined initially on the server. And the error is only for one user and only in chrome!
It seems that I found a post with the same situation https://github.com/nuxt/nuxt.js/issues/3575 but they didn’t come to anything there.
What can be wrong?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question