fancytree
fancytree copied to clipboard
Assertion Failed; prev row
Issue: persist fails intermittently when reapplying open state to fully or partially open fancytree with table.
- Version: 2.38.0 and previous (I think 2.36 was the version prior to upgrade but same issue)
- JQUERY: v 3.4.1
- Jquery UI v v1.12.1
- ext-table, ext-persist are in use
- custom render handling that can be quite complex, but is pretty speedy in this case. (There are two types of rendering: one is basica formatting based on column information, and then it injects data-whatever elements into each tr for links within the table that are composed when clicked.)
- AJAX data coming from a .NET webservice. (It is called and loaded before triggering the fancytree to build itself. It's very fast.)
- AJAX returns json "flat", which is converted to nested json before being bound to fancytree grid. (This is also very fast.)
- NOT lazy loading.
- configured to use local storage with a custom key, and ONLY storing open state. Key pattern is tablename_[compressed values], so that when year or other filters are set, it should return the same data and thus expand same elements)
- While normally the tree-grid sits inside of a jquery datatable with its own scrolling and fixed header, I disabled that and this issue still occurs when those items are not applied.
- For speed reasons, I had put the grid in display:none mode until it's complete, and then put back into display:table. However, when I removed that step, the problem still exists.
- BROWSER: Chrome (99.0.4844.82 (Official Build) (64-bit)) and Edge must be supported. Same issue occurs in both.
- jquery-fancytree-all.js is bundled and minified by .NET
Problem behavior: from a fully expanded tree grid of 200+ rows, go elsewhere in app and return to this screen. Data correctly loads based on on-screen fiters, and it correctly applies the state. Well, MOST of the time, but intermittently it fails and throws an error which stops and breaks the tree. This appears to happen MOSTLY when using a fully expanded grid, and not when only a few branches are expanded.
The console throws an assertion error: "prev. row must have a tr, or be system root". SOMETIMES, simply reloading the screen without changing anything make it work just fine. In other cases, I have to clear the persistence from localstore before the screen will load.
What I've determined:
- The issue is not a webservice issue -- the data is returning just fine and the entire set is always returned.
- When I console.log the node back, it appears to be correct, and it has a parent that is a TR or is system root.
- The parent/child relationships are correct
- There is no unusual traffic load or memory issue on either the server or client
- The data is not remotely big -- it's under 120 kb
- The table isn't huge -- it's 20 columns by 223 rows, and no more than six layers deep in a branch, and about a dozen branches.
- The issue SEEMS to be in the findPrevRowNode(node) call. It seems to happen less frequently when I pepper a bunch of console.logs in there to track what's happening -- which is maddening.
As i was walking through posting this, I tried something else on a whim.
- Normally, the js libraries and custom files are minified by the server (.net handles it). I left them uncompressed/bundled for better troubleshooting, and it still happens.
Expected and Actual Behavior
Obviously, I want the persisted state to be applied and the branches correctly opened up.
Steps to Reproduce the Problem
This gets tricky because I can't recreate from scratch, or even pretty consistently from our development server.
Here is the configuration for persist:
persistConfig = {
store: "local", // 'cookie': use cookie, 'local': use localStore, 'session': use sessionStore
types: "expanded", // which status types to store "active expanded focus selected"
// Available options with their default:
cookieDelimiter: "~", // character used to join key strings
cookiePrefix: gridName + "-v" + viewID + "-fy" + fy + "-ft-", // 'fancytree-<treeId>-' by default
cookie: { // settings passed to jquery.cookie plugin
raw: false,
expires: "",
path: "",
domain: "",
secure: true
},
expandLazy: true, // true: recursively expand and load lazy nodes
expandOpts: {noEvents:true}, //undefined, // optional `opts` argument passed to setExpanded()
fireActivate: false,
overrideSource: true, // true: cookie takes precedence over `source` data attributes.
};
Hi, as you say, this is difficult to reproduce, however the 2nd approach described here
https://github.com/mar10/fancytree/wiki/ExtPersist#persistence-in-a-lazy-world
would be more efficient anyway?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.