Code Monkey home page Code Monkey logo

Comments (4)

mrleblanc101 avatar mrleblanc101 commented on May 23, 2024

Using optional chaining user?.photoURL or v-if fix the issue but I do not understand why

from vuefire.

mrleblanc101 avatar mrleblanc101 commented on May 23, 2024

Maybe it's related, but after using the above workaround, I get this error on logout:

Uncaught (in promise) FirebaseError: Function where() called with invalid data. Unsupported field value: undefined.

My useCollection has a where where('user', '==', user.value?.uid), to only get data from the logged in user as bellow:

const entries = useCollection<Entry>(
    computed(() =>
        query(
            collection(db, 'entries').withConverter(dateConverter),
            where('user', '==', user.value?.uid),
            where('date', '>=', weekStart.value),
            where('date', '<=', weekEnd.value),
        ),
    ),
    {
        ssrKey: 'entries',
    },
);

So before my logout, I call store.$reset which should "unbind" the useCollection ?
I'm not sure if it's the right way, but pinia does not have a build-in store.reset for setup store and vue-fire has un $unbind but only in the option API, so maybe i'm doing something wrong.

function $reset() {
    projects.value = [];
    priorities.value = [];
    entries.value = [];
}

from vuefire.

mrleblanc101 avatar mrleblanc101 commented on May 23, 2024

I also get this, so I guess I'm doing something wrong when I try to force Vue to stop triggering my useCollection when I logout.

[Vue warn]: Unhandled error during execution of scheduler flush. This is likely a Vue internals bug. Please open an issue at https://new-issue.vuejs.org/?repo=vuejs/core

from vuefire.

mrleblanc101 avatar mrleblanc101 commented on May 23, 2024

I wonder if this is not a bug with Nuxt 3, as clearly my "on loged out" should be called after the mount of the logout page.
I even added a nextTick just to be sure !
Screenshot 2023-10-11 at 12 37 03 AM

async function logout() {
    console.log('on logout');
    const auth = useFirebaseAuth()!;
    const localeRoute = useLocaleRoute();
    const store = useIndexStore();

    await navigateTo(
        localeRoute({
            name: 'logout',
        }),
    );
    store.$reset();
    await nextTick();
    console.log('loged out');
    await signOut(auth);
    return navigateTo(
        localeRoute({
            name: 'login',
        }),
    );
}

from vuefire.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.