Skip to main content

Multi-Page Apps FAQ

How do I share state across my pages?

At this time, state can only be shared between pages using the URL (route parameters and query parameters).

If you need to share data, such as API responses across pages, the best way to do so today is to duplicate the API to each page, and re-run the API onPageLoad. This approach ensures the data will be available whenever the page is loaded, regardless of how the user reached the page.

We will soon introduce app scope, which will enable you to share data across pages using app-level variables.

Can I update query parameters without re-triggering APIs that run onPageLoad?

Yes, you can use the dedicated Update query parameters action type to update the page's query parameters without re-triggering the pageLoad event.

This feature is useful if you want to maintain some state in query parameters, such as form state, without reloading the API every time you update the URL.

Can I share a standard navigation bar or header across pages?

There is currently no way to share UI across pages in Superblocks apps.

However, if you plan to use the same layout across many pages, you can create a single page to be used as a template with this UI. You can then duplicate this page each time you want to create a new page, so that you don't need to manually copy over the layout to the new page.

If you take this approach, you probably will want to make the route for your template page something more obscure, and ensure that you don't link to this page in your app.

What are editor fallback parameters?

When navigating to a dynamic route, a value for every route parameter must be provided in order for the route to match. Whenever you navigate to a dynamic route in your application, you'll provide this value explicitly.

However, in the Superblocks Editor, it is possible to select a page with a dynamic route from the Navigation, navigating to this page without explicitly providing that values for each route parameter. In this case, the system uses the Editor fallback parameters as the values in the URL.

These Editor fallback parameters are only ever used the Superblocks Editor - they will never be used in a Deployed App.

For example, imagine I select a page with the route /users/:id in the navigation. If my Editor fallback parameter for userId=1, then I'll be navigated to /users/1.

The Superblocks Editor has two sets of built-in behavior to make this case simple and intuitive for you.

  1. During an editor session, the system persists most recent URL parameters. For example, if I navigated to /users/2 and then switch pages, but then come back to this page via the navigation, I'll be navigated back to /users/2.
  2. When you first build a page with a dynamic route, the system automatically populates TEST_VALUE for the route parameter in the URL. As soon as you update this URL (by manually editing the URL or navigating to the page from the app), the system automatically saves the new values as the Editor fallback parameters.

How do I build a navigation bar or sidebar nav?

In Superblocks, you can easily build your pixel-perfect Navigation using a combination of Layouts and Multi-Page. Check out the step-by-step guide to build a sidebar navigation.

Additionally, if you would like to build a custom navigation component to navigate between the tabs in your app, you can follow this detailed guide!

When should I opt for a multi-page app vs splitting out multiple separate apps?

Splitting your app into multiple pages and using multiple separate apps are both viable options for managing complexity in Superblocks.

Generally, we recommend the following:

  • If a single development team is responsible for the feature set, and this codebase should be version-controlled as a unit, it likely makes more sense as one multi-page app
  • If development responsibilities are sprawled across multiple teams and the functionality should be version-controlled separately, this is a good indication you may be better off developing multiple separate apps Both options are well-supported in Superblocks. Thus, the distinction between these two options ultimately comes down to your team’s preference!

Can I control access to specific pages?

There is currently no way to restrict access to specific pages in an application - Superblocks RBAC only supports access controls at the application-level.

We plan to support page-level access controls in the near future. If this is important for your use case, please submit a ticket to Superblocks support.

When would I have multiple routes to the same page?

Most pages will have a single route.

Some scenarios where you may want two routes to the same page include:

  • A home page which has both the root slash route / and also a named route (i.e. /home)
  • A generic page that can handle multiple types of data, such as /customers and /prospects. In this case, you would likely have dynamic behavior on your page based on the specific route.

I am seeing an error that my files are in single page format, but the multi-page feature is enabled for my account. How do I resolve this?

This issue arises when you have an outstanding branch using the single-page app file structure, and attempt to push this branch into Superblocks while multi-page is enabled. To resolve this issue, follow the steps here.