Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I looked at your changes! And see bugs! #7

Open
parajbs opened this issue Apr 21, 2022 · 1 comment
Open

I looked at your changes! And see bugs! #7

parajbs opened this issue Apr 21, 2022 · 1 comment

Comments

@parajbs
Copy link

parajbs commented Apr 21, 2022

Hello Fluffy9,

I looked at your changes!
The line:

      if (!data['data']['!']) {cb(null, JSON.stringify(data['data']) || undefined)} else { cb(null, undefined)} })

you just have to change it like this:

cb(null, JSON.parse(data['data']) || undefined) })

The line in "store.put" is much more important for you

       client.db.setJSON(privateKey, key, data).then(() => {cb(null,1)}).catch(err => {

in new:

       client.db.setJSON(privateKey, key, JSON.parse(data)).then(() => {cb(null,1)}).catch(err => {

Now it should be right!!!!!

To test if it works!!!! :
Important for TEST! Please set a new secret!!

  1. just run gun.get('hello').put({ name: "SuperWorld" }); but please before comment out this line:

gun.get('hello').on(data => { hello_world = data['name']; alert("hello: " + hello_world)

Please don't bother if the new SECRET shows a few errors in the browser console! Two passes no longer show errors!

#######

  1. So that it outputs a clean log in the browser console, please repeat the procedure as in number 1!

Now the new value "SuperWorld" is under the key "hello"! all ok
Next, we'll pick up the "hello" key again! see number 3!

#######

  1. only execute gun.get('hello').on(data => { hello_world = data['name']; alert("hello: " + hello_world), but PLEASE first comment out this line gun.get('hello ').put({ name: "SuperWorld" });
    Very important for test nr 3! comment out gun.get('hello').put({ name: "SuperWorld" });

Now with Gun Options (localStorage: false, and radisk: false,) the result "hello: SuperWorld" should be displayed in the browser console!

For gun options, you should use

file: "skydb1",
radisk: false,

Very important! The first option file: "skydb1", is only so that the test does not use the old db from the browser, but creates a new empty one, so that there are no incorrect results!
The second option is also important radisk: false, this tells Gun that should save und get no data in/from the new browser db "skydb1", but with every query that retrieves new data from SKYNET!
So they always have the latest data!

  1. It could be if a friend of yours with the same SECRET in another browser or another location issued the command:
    gun.get('hello').put({ name: "SuperWorld222" });
    To run!

  2. Now if you do nr 3 again!
    The newest result should now show "hello: SuperWorld22" in the browser console!!
    If you didn't have gun options "radisk: false," gun would fetch data from browser db first and then later from skynet and it would be different results!

Have fun testing
Can tell me about the bugs and success

@parajbs
Copy link
Author

parajbs commented Apr 21, 2022

Sorry

radisk: true,

not 👍 radisk: false,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant