Spotted a bug? Have a great idea? Help us make google.dev great!

Goals

In this codelab, you'll build a restaurant recommendation web app powered by Cloud Firestore.

What you'll learn

  • Paginate your data with Cloud Firestore.

What you'll need

This codelab builds on the the previous codelab in this Playlist. It is assumed that you have completed that codelab, if not please go to the previous codelab before continuing here.

To enable persistence for our restaurant recommendation app

  1. Go back to the file scripts/FriendlyEats.js.
  2. Find the Enable offline persistence TODO comment
  3. Replace the TODO comment with the following code.

FriendlyEats.js

firebase.firestore().enablePersistence()
.then(function() {
  console.log('Persistence enabled');
})
.catch(function(err) {
    if (err.code == 'failed-precondition') {
        console.error('Multiple tabs open');
    } else if (err.code == 'unimplemented') {
        console.error('Current browser does not support persistence');
    }
});

In this codelab, you learned how to paginate data with Cloud Firestore.