question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

When restoring the graph state, labels that contain icons are renamed to 'fn'

See original GitHub issue

Issue type

Bug report

Environment info

  • Cytoscape.js version : 3.8.4
  • Browser/Node.js & version : latest Chrome

Current (buggy) behaviour

When saving the graph state using cy.json() and then restoring the graph state using cy.json(json), labels that contain icons are renamed to ‘fn’.

Desired behaviour

The state should be restored without changing the labels.

Minimum steps to reproduce

In the demo, click on any node and notice the label change. https://output.jsbin.com/xerowokidu

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
maxkfranzcommented, Sep 17, 2019

I would generally avoid calling cy.json() with non-serialisable data. It wouldn’t be congruent with use of cy.json() as a getter. You could replace the cy.json(style) call with cy.style().

On Sep 17, 2019, at 15:54, Josejulio Martínez notifications@github.com wrote:

I would like to continue setting icons through functions in the style definition, but I also need the zoom, pan and maybe some other properties.

Yes, if only the styles are being serialized incorrectly (and you pre-configure them), you can strip it away from the json such as:

const json = cy.json(); delete json.style // … cy.json({‘style’: preConfiguredStyle}); cy.json(json); That way you save everything but the styles (or anything that can’t be serialized) in json format.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/cytoscape/cytoscape.js/issues/2516?email_source=notifications&email_token=AAHRO42W3EMZWMGAC344T23QKEYWBA5CNFSM4IVSGIG2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD65WTJI#issuecomment-532375973, or mute the thread https://github.com/notifications/unsubscribe-auth/AAHRO43ULKTCQXO4E346SK3QKEYWBANCNFSM4IVSGIGQ.

0reactions
IfatChitincommented, Sep 23, 2019

Thanks! My style doesn’t change and it is defined as an object. This solved my issue in a satisfactory way:

cy.json(json); cy.style(myPredefinedStyle);

Read more comments on GitHub >

github_iconTop Results From Across the Web

Undo- all folders on desktop renamed - Microsoft Community
- Open File Explorer (Windows Key+E) and right click the Desktop folder. ... - Have a look if there are any entries under...
Read more >
Labels - GitLab Docs
Changed labels are immediately visible to other users, without refreshing the page, on the following: Epics; Incidents; Issues; Merge requests. To assign or ......
Read more >
Logix 5000 Controllers Function Block Diagram
The Logix Designer application automatically determines the order of execution for the function blocks in a routine when: • Verifying a function block...
Read more >
Add legend to axes - MATLAB legend - MathWorks
This MATLAB function creates a legend with descriptive labels for each plotted data series. ... The axes object contains 2 objects of type...
Read more >
Built-in Macro Functions - ImageJ
This function has the advantage of not closing the "Log" or "Results" ... using the specified label and default state (true or false)....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found