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

Update saveJSON to return serialized data #140

Open
HieronymusLex opened this issue Oct 5, 2022 · 8 comments
Open

Update saveJSON to return serialized data #140

HieronymusLex opened this issue Oct 5, 2022 · 8 comments
Assignees

Comments

@HieronymusLex
Copy link

Currently the saveJSON returns nothing and always writes to file, however there are use cases where one would want the contents of what saveJSON is writing, without actually writing it to a file (e.g. in order to pass the data to an API call).

Could we have saveJSON:

  1. Conditionally write to file
  2. Return the stringified data that is being written

Alternatively, this could be surfaced via a new method?

@hasanbalci
Copy link
Contributor

I think you're right. We will look into that.

@hasanbalci
Copy link
Contributor

Now, saveJSON always returns the stringified data and writes to a file only if filename parameter is provided. If not, it doesn't write to a file. The change is done in the unstable branch and will also be active in the master branch when we merge it before a release. @HieronymusLex, can you please verify and close the issue if it is ok?

@HieronymusLex
Copy link
Author

@hasanbalci seems to be working - thanks! One issue I'm running into is if I:

  1. collapse a node
  2. store the result of saveJson then refresh the page, and pass the previously stored result to loadJson
  3. try to expand the collapsed node

only the collapsed children appear correctly, not the "collapsed edges". The console displays an error saying:

expandCollapseUtilities.js:622 Uncaught TypeError: Cannot read properties of undefined (reading 'id')
    at Object.findNewEnd (expandCollapseUtilities.js:622:1)
    at Object.repairEdges (expandCollapseUtilities.js:638:1)

which is caused by parent being undefined at parent = parentData[parent.id()];

Pseudo code for reference:

const data = canvas.expandCollapse('get').saveJson()
// store data....refresh... get data
const api = canvas.expandCollapse('get')
api.loadJson(data)

Any ideas what could be happening here?

@Nicolas-PredictaLab
Copy link

Nicolas-PredictaLab commented Apr 24, 2023

So it never reached the master branch, right ? :D

@ugurdogrusoz
Copy link
Contributor

@Nicolas-PredictaLab We are currently working on a unified complexity management framework, so this one is not maintained. Sorry.

@svozza
Copy link

svozza commented May 3, 2023

Can we put an indication in the README that this library is not maintained, just so people know for when they start new projects to use use something else?

@ugurdogrusoz
Copy link
Contributor

Can we put an indication in the README that this library is not maintained, just so people know for when they start new projects to use use something else?

Done

@svozza
Copy link

svozza commented May 5, 2023

Thank you!

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

5 participants