60
Views
5
Comments
Pages as web blocks
Question

Hi all,

I just want to have some opinions about how to handle pages vs web blocks.

I was wondering if there are any big reasons why you wouldn't have one page to contain a header and footer and move through different web blocks in the content. 
The use case that we have at the moment is that we have an app (PWA) that contains multiple pages that all contain the same header and footer in the layout. Navigating to one of these pages causes the layout to reload which feels unnecessary since it is going to be the exact same information and actions. It is basically only the content that changes. So instead of having 10 pages that essentially refresh the layout every time that you navigate between pages, rather have one page and 10 web blocks where the different web blocks become visible as you "navigate".

Kind regards

Stefan

2024-12-02 13-16-47
Vipin Yadav
AI Generated

Hi @Stefan van Deventer ,

Your Quires on handling pages versus web blocks in OutSystems, particularly regarding the use of a single page navigation model, touches on an essential aspect of web development: optimizing user experience and application performance. Here’s an analysis of both approaches: 

Single Page with Dynamic Web Blocks

Advantages:

  1. Performance: Reduces load times between navigations as the header and footer are loaded only once.
  2. Consistency: Ensures a uniform look and feel across different parts of the app without the need to duplicate code.
  3. Maintenance: Easier to maintain and update the UI components like headers and footers.


Challenges:

  1. Complexity in State Management: Managing the visibility and state of multiple web blocks can become complex.
  2. Initial Load Time: The initial load might take longer as the complete page with all possible blocks must be loaded upfront.
  3. SEO and Bookmarking: Dynamically changing content might affect SEO, and users might not be able to bookmark specific states or content.


Multiple Pages with Replicated Layouts -

Advantages:

  1. Simplicity: Each page is independent and can be managed easily.
  2. SEO Benefits: Better for SEO as each page can be optimized for specific content.
  3. Bookmarking/Caching: Users can bookmark pages, and browsers can cache pages independently.

Challenges:

  1. Performance: Each page reloads the common elements like headers and footers, which can make the app feel slower.
  2. Redundancy: Increases the redundancy of code, which can lead to higher maintenance overhead.


Recommendations:

  1. Given your use case of a progressive web app (PWA) where the header and footer remain constant across different views, 
  2. adopting a single page application (SPA) approach using one page with multiple web blocks might be more beneficial. 


This approach would:


  1. Improve the perceived performance by loading the layout once and dynamically updating the content area.
  2. Reduce the redundancy of having the same layout components reload with each page visit.
  3. Streamline maintenance efforts as changes to the layout need to be done in one place only.
  4. To address the complexities associated with this model, such as state management and initial load performance.


You might consider:


  1. Lazy loading for web blocks, where blocks are loaded only when needed.
  2. State management tools like React’s Context API or Redux (if using React) to handle the state of different blocks effectively.



This answer was AI-generated. Please read it carefully and use the forums for clarifications
2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

Hi Vipin,

Please don't use ChatGPT or the like to answer on this forum. OutSystems is not well-known enough for ChatGPT or other AI products to produce meaningful answers.

2021-09-06 15-09-53
Dorine Boudry
 
MVP

Hi @Stefan van Deventer ,

having some interchangeable blocks in a single page is a valid approach

a few things to consider

  • it saves on some AO's 
  • total amount of blocks to load, as this will increase the volume of js and other files to bring down when first loading the screen
    • so if you are sure all screens will be touched at some point in this session (like for a wizard) then you are just bringing to front the loading, fine, I guess
    • but if some parts of your UI will only rarely be used, then it is a real shame to always load those js files as well
  • you can't make use of different levels of screen authorization between them, so this would work best if all parts of the UI that you put in one screen, have the same authorization
  • If all those bits of the UI need to be adressable, your will have to put extra work in your url's (like in a menu)

Dorine

2020-12-07 12-30-07
Stefan van Deventer

Thanks Dorine

Jip, I assumed the loading of all the JS would likely be the biggest concern. The addressing and authorization won't be a problem for this specific use case, but it is good to keep that in mind. 

I guess the only way to see what the performance impact would truly be is to test it. 

Thanks again

2021-09-06 15-09-53
Dorine Boudry
 
MVP

A while back, I had been working on how I would do this, but then abandoned because of lack of time.  

It is gone from my personal environment (space !) but I will try to dig op a saved OAP if I can


Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.