Autoload storage is not working on page refresh
Question
Hi, firstly I want to say that this project is awesome, thank you!
I used code from GrapeJS Demo example, and added there save and load data from remote files, this is my storageManager code:
storageManager: {
id: 'gjs-', // Prefix identifier that will be used on parameters
type: 'remote', // Type of the storage
autosave: false, // Store data automatically
autoload: true, // Autoload stored data on init
urlStore: 'save_now.php',
urlLoad: 'load_now.php',
params: { page_id: 11111 },
contentTypeJson: true,
headers: {
'Content-Type': 'application/json'
}
}
save_now.php file code:
header("Content-Type:application/json");
$data = file_get_contents("php://input");
file_put_contents('test.txt', $data);
load_now.php file code:
header("Content-Type:application/json");
$response = file_get_contents("test.txt");
echo $response;
When I am saving my changes it is working fine, but after that if I am press to Refresh page it loads old content which was before my changes.
But if I use Hard Refresh page than it is content is fine it is showing my last changes.
How can I keep saved content when user refreshing page?
It seems that it is saving old content somewhere and reloading it after refresh but not using urlLoad from storage manager that I defined.
May be there is a way to disable loading of old content and only use urlLoad from storage Manager?
Answers (2)
Same issue like on https://github.com/artf/grapesjs/issues/2963. But in my case it is loading content only after Hard Refresh
Sounds more like an issue from your side, web applications do not distinguish Refresh from Hard Refresh, indeed the Hard Refresh is more like a refresh without the browser local cache. Try to check, from the inspector, if your load call is actually returning the correct data (eg. maybe you have a web server with kind of cache enabled)
Related Questions and Answers
Continue research with similar issue discussions.
Issue #2178
loading remote data
Im working on a project and having a hard time getting remote data. Code: storageManager: { id: 'gjs-', // Prefix identifier that will be u...
Issue #2009
'Select' trait no updated in edit mode
Hi there, There is a problem with me, I don't know if it from my code or from grapejs itself, For LINK tool, it takes its links from my DB...
Issue #1673
[Issue] Grapesjs not working when use with mobile devices(iphone,ipad)
First, thank you for creating this awesome framework @artf. I integrated this framework with my project and i want it to be used through mo...
Issue #1466
Editing Saved html editor.setComponents slider load issue
I am working on a project where i integrated grapesJs for users to build there templates, save them in database and edit these saved templa...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.