🎭 Data Collection Types

402

When you GET data from your base, you will have three options to handle the data in WeWeb:

  1. Dynamic mode
  2. Cached mode
  3. Static mode

By default, WeWeb will propose you create the Collection in Dynamic mode, but what’s the difference between the three?

⚑️Dynamic Mode

This is the Collection type selected by default because it is most suitable for web-apps in the sense that, when you make a change in your database, the WeWeb editor and your published web-app are updated instantly.

When a user makes a change to your database based on their interaction with your web-app, your database and the live user interface are updated automatically.

You do not need to republish your project, or resync or refetch the collection in WeWeb.

This is the most suitable Collection Mode for web-app functionalities because data needs to be updated dynamically based on:

  • user interactions with the frontend, and
  • changes your team might make in the backend.

However, if you are using a third-party API with rate limits, this Collection Mode may not be practical.

Indeed, if there are a lot of user interactions in your web-app, you may quickly reach the tool’s API rate limits.

As a result, your web-app will stop responding to user interactions and users who are not aware of this limit might think it is broken.

πŸͺžCached Mode

Cached mode allows you to respond to user interactions without running into API rate limits of third-party tools.

How does it work?

When you set up a Collection in cached mode, WeWeb copies the data in a secure database.

This allows you to display and filter the data as you like. Your web-app can respond to user interactions without worrying about hitting API rate limits.

When a user updates the Collection through your web-app, it will first update the cached data in the database. Then, in a matter of milliseconds, it will update the data where it is located (in Airtable for example).

You will not need to republish your project for the changes to appear on the user interface.

The downside of the cached collection is that, if someone makes a change to your database outside of the web-app workflows (e.g. going into Airtable to edit it directly), then you need to resynchronize the cached data in WeWeb.

You can do this manually in the WeWeb editor, or you can use webhooks that you can call directly with any other tools or custom backend.

πŸ“Static Mode

Static mode is the go-to collection type if you need to optimize a Collection for search engines.

When you set up a Collection in static mode and create a Collection Page for items in your Collection, WeWeb pre-renders the data on individual pages with fixed URLs.

This enables search engines to discover and index your content.

The downside of the static collection type is that, if you make a change in your data, you need to synchronize the collection manually in WeWeb and republish the project to reflect that change in the live project.