Template re-use initially shows old data - meteor

I might need to provide a lot more information for anybody to give me any meaningful feedback, but let me first attempt to describe the issue.
I have an app that lists items for sale. Each item has an individual unique page in my app, but the same template is used for rendering each of those pages. The first item page I load up is rendered perfectly. The same is true for the second page, but because the template has already been used to render an item before, I get a brief flash of the content (images and text) from the previous item.
Obviously, this could be an issue with me setting reactive variables after the template is rendered, but since I specifically destroy all reactive data associated with the template when I navigate away from the page, I am more inclined to believe that this is an issue with how a template is re-used by meteor. I would assume that the template is cleared of all previous data before it is re-inserted into the DOM, but that does not seem to be the case.
Anybody have any experience with this type of issue?

Related

How to fix 'Multiple blocks of same type on page, sharing data on edit()'?

I started block development recently and I just came across a problem. Let say I create one block twice on a page. I edit that block. As soon as I click the second block it takes the over the same data as the first. On preview the behaviour is the same but if I now refresh the editor page both blocks are treated seperatly. What am I missing out?
I added unique ID's but that did not help. I rewrote my data structure aswell.
Sadly there are no error messages. All I know that updating one value will trigger the callbacks of all the blocks of the same type. The state is only updated for the selected one.

Symfony fixed elements on the page

I have the following problem, I have a template layout.html.twig which is loaded everywhere, in it I have a menu with categories downloaded from the database, and now my question is how to make a list of categories from the database in each controller from the machine, instead of each time download a category repository and all categories from it. I have been working in Symfony for a long time, but I create the API without views, hence the problem. Generally, I would like that after loading layout.html.twig a list of categories has been downloaded without my intervention, bypassing the loading of this list in every action of the controller.
I have fixed elements on the site, such as: category menu downloaded from the database, on the main page I have popular articles that also have to be on every subpage, and it makes no sense to download everything in every controller every time.
Any ideas?
I would create a menuFragment method in my DefaultController, and use a sub-request to render it.
https://symfony.com/doc/current/templating/embedding_controllers.html
Some people will tell you that sub requests slow down your code, but it is not significant if you don't go overboard with it. 1-3 subrequest won't be a problem at all.

Drupal Embedded views not working correctly

I recently took over a site from someone else at a new company. Having never used Drupal before, updating things has been a bit cumbersome. There were some outstanding security updates that I applied(but I haven't updated the core yet). Anyway, after doing this, the calls to views_embeded_view have not been working. For example:
print views_embed_view('news_block');
Will break the links(by using the title, rather than alias for the link), or it will link correctly, but not follow the paging rules I have set(show 1 page, 6 items per page) instead it shows 10 items and has links for other pages.
I am not sure if the update has anything to do with it, but it seems likely. Would updating the core resolve this issue potentially?
The first argument of views_embed_view is view name, the second one is display id. If display_id is not provided, 'default' is used. Make sure that you are displaying the correct display. (i.e. default can be configured differently than some other display which you actually wish to see)

Drupal Multi-step form breaks with node save

I have a custom multi-step form that I add to certain node type content via hook_nodeapi. It is working great, with one exception.
During testing, I've found that when I am in mid-form (say, step 2 of 6) and update the node in another browser tab, my form reverts to step 1 when I try to proceed to the next step. Similarly, when an AHAH event occurs, I get an error and the form disappears altogether. The error suggests there is a problem with retrieving the form from cache after a node update, as it's not able to retrieve the form parameters.
Have you encountered this behaviour before, and/or do you have any suggestions on how I might go about fixing it? It isn't a huge problem as these nodes likely won't be updated too often on the production side, but it would still be a significant nuisance to those it does affect.
Edit: Thanks for your response. Unfortunately I can't contain this form within a block. It must be within the node content itself. Upon further testing I noted that other users thankfully aren't affected. It is only the user that updates the node while in mid-form that is affected. As this is extremely unlikely to happen on the production site, the impact of such an occurrence would be minor, and I have no time at the moment to explore this further, I'm going to move on with this behaviour unexplained for now. But if anyone can point out why this is occurring, I'd appreciate it.
Well, have just tried your situation based on multistep form described here - http://zgadzaj.com/basic-drupal-multipart-form-example-with-previous-and-next-buttons - but put in the block and displayed on node page, and even if I edit this node in a different tab, I still can navigate between all form steps on the original tab, keeping all already submitted values. So I'd say it all probably depends how your form is being built...

VB.Net application - display a message to the user whilst the application is starting up

I have recently created an application where a lot of data is loaded into objects when the application starts up, and other data as it is required. For example if the user requests the catalogue page then it will load all the top level category data into objects of type Category. This will then stay there to be used by other users (who will therefore not have to load this data into objects) and can be altered by admin if they happen to login during the same application instance. I know this is not the most efficient solution, as pointed out below, but it works and the page load, at the moment, is not too long. It is very quick if most of the required data is already loaded into objects. It is also tailored to the business' needs - unlike other techniques such as Linq-to-SQL.
The problem I am facing is when a page is requested which requires lots of data to be displayed about different types of object. For example when a catalogue page is requested which displays information on a product which can be bought, it then loads all the products and categories (as the products make reference to the category object, not just the category name).
I would like to display a loading symbol with a message whilst all this data is being loaded into objects, so the user knows its not just in a loop or anything. Is there any way to do this? I am open to using JS / jQuery if I need to.
Thanks in advance.
Regards,
Richard
PS I am working on ways to make it more efficient - such as using HashTables or HashMaps. However this is taking time as there are so many different types of item (News, Events, Catalogue Item - Range, Collection, Design, RangeCollection, CollectionDesign, RangeCollectionDesign and RangeDesign - Users, PageViews and the list goes on).
Please correct me if I'm wrong, but I do believe that Javascript is required in order to display a "loading" image... Using server-side scriping alone would typically require an entire page load after all the content loads unless you want to start messing with IFrames.
This is a job for AJAX. A common solution to your problem is to have a small page that displays a loading icon. The page has some JavaScript that makes additional HTTP requests to the server to download the rest of the page. JQuery has a "$.ajax" method that is designed to simplify this process.
I would suggest looking at the documentation to the .ajax method in the jQuery documentation. Unfortunately, it seems to be a rather delicate process to get all the scripting code right and it takes a while to learn it all.

Resources