Open awdDev786 opened 7 years ago
Can you open the console and check if it's giving any errors after import? Also check the json file if it contains the tables you created.
yes there is no error in console and even json file contains the tables i created.
I tried importing on Official Demo site too but it didn't work.Kindly share example schema.json file which is working on mentioned link so that i can compare with my schema.json for identifying error.
Works fine for me, here's a sample json file.
it is neither showing any schema nor giving error.
Then probably it's a browser issue, try clearing cache. It's working fine for me. Also if you can, give me a sample json file so that I can test it.
Google version : 60.0.3112.113. Windows:10 64bit database name is same as in schema.json.tried with cache cleaning and the same schema.json file u sent.
I have sent schema.json at mail.kindly have a look.
Got the mail, seems like the one I sent. Again it works here. Can you import the json file again and after it is imported, go to console and use this command
JSON.parse(localStorage.getItem('schema'))
The output should match the json file, if not that's the issue you're facing IMO.
ok thank u for lead.m checking it.
its empty schema without any table while schema.json has tables.
Another thing, when you're building a schema and then refresh the page, does it start from the beginning or it persists all the work you did until now ?
it persists when i refreshed page
Then it's certainly an importing issue, how are you importing it ? Just clicking import and select the json file, right ? Cause there's no other way as far as I remember.
Can you try importing files with different extensions and see if it gives an alert like 'Please select the exported json file'
yes it gave this error once.i changed the db name and kept them same.error vanished nw have no clue
I've no clue as to what's happening on your side, I tried many times on my side and it works every time. So I haven't been able to reproduce it once. As a last resort, you can try with different browsers and see if it works.
I am also facing the same issue and one more observation is i am passing a value from header to schema component where it is updating the localstorage.but change in localstorage isn't updating component.I think both issues are same that change in localstorage after component is already rendered isnt re-rendering the component.
localStorage change doesn't trigger re-rendering. It's only purpose is to read the saved state when you reload the page.
@Agontuk kindly look at this video of issue.I made it for you. ISSUE is described here.
My browser is: Google Chrome | 61.0.3163.100
Thanks for the video, it looks like your browser is not reloading itself after importing the json file. I'll take a look at it ASAP.
I pushed a possible fix for this issue, let me know if it works for you.
Official Demo is still having the same issue.and also cloning new version didn't do the trick.(Sorry for accidentally closing it.)
@awdDev786 can you check if this snippet works in your browser? I think FileReader API is somehow not triggering any event on your end.
Through this code only .txt files can be read.schema.json file is not being read.
So, it worked with .txt files ?
yes.it read .txt file
Thanks, I'll try another fix.
Ok thank you for your concern.
@awdDev786 can you clone this and try adding a console.log statement here. Then see if it logs to console when you import a file. I thought FileReader API is the culprit, but now I think file input change is not triggering on your end.
@Agontuk not working.same behavior.
So, handleFileUpload
method is not getting called ?
File is being uploaded and read here.handleFileUpload is also called.
sorry for bothering you again,can u find some solution of this issue?
@Agontuk empty console in both locations.
@awdDev786 I'm out of ideas about why it's not working in your system. I'll try to investigate it more and see if I can reproduce it in my system. Please let me know if you have any ideas.
@Agontuk Kindly update your online demo so that we can try there too.
Done, please let me know if you figure out what's the issue.
I have tried 5 different solutions described below:
I thought it can be an issue with my local deployment but same isn't working in official demo which means not an issue with deployment.
I also deployed it on a vps same issue means not an issue with my environment.
Additionally also tried with ms edge browser and mozilla so no issue with chrome.
Possibility is may be an issue with file import export.following are the steps i followed:
Possiblity of fileupload is also checked before that no file is being uploaded.
So @Agontuk Would you please share a youtube video where you are successfully exporting/importing schema so that I can understand the correct workflow?
Thankx for your time.
What do you mean by "it firstly gave error"? That should never happen, unless you import files which don't have .json
extension. Since the file you exported is a json file, it shouldn't occur. Can you explain this scenario in more detail?
Yes file is with .json extension but as we have already checked by console that file is not being read here so it is not getting any file that's y it is giving such error.
I'm checking the file type before reading it, so it shouldn't be giving this error. Anyway I just pushed a fix for an issue you mentioned on fourth point. Can you check locally if it changes anything on your end?
It is giving same error of unexpected schema at first import.so seems no lead on issue locally.
From your previous screenshot, I'm seeing file.type
is empty. That's why it's giving the error. I'll check why it's being empty and make a fix asap.
I'm thinking of exporting the file as a .txt instead of .json, will let you know when it's done.
@awdDev786, I've changed the import & export feature to use .txt file. Can you rename your schema.json to schema.txt and see if it works locally?
@Agontuk issue was resolved as your updated code. You have used this code to display imported schema.
window.location.reload();
I tried replacing it with some solution as i only want to reload/refresh
I exported JSON schema and then deleted all tables from database.then i tried importing same JSON schema ,it isn't giving any error but not importing schema too. I tried following solutions before importing schema
deleted previous db and created new with same name and imported
deleted tables from existing db and imported
no change in existing db and tried importing
etc But no solution worked.
Kindly guide me how to import the JSON schema or help me in identifying my mistake.