redballoonsecurity / ofrak

OFRAK: unpack, modify, and repack binaries.
https://ofrak.com
Other
1.85k stars 126 forks source link

Decouple ResourceTreeNode.svelte from the resourceNodeDataMap #339

Open dannyp303 opened 1 year ago

dannyp303 commented 1 year ago

What is the problem? (Here is where you provide a complete Traceback.) Currently, in the GUI the object resourceNodeDataMap is populated while recursing through and displaying the ResourceTreeNode components. These should be decoupled for use in separate applications.

Please provide some information about your environment. At minimum we would like the following information on your platform and Python environment:

If you've discovered it, what is the root cause of the problem? In #334 filtering is accomplished by opting to not display the ResourceTreeNodes that do not appear in searchFilter. In this implementation, the children of each node still contain ResourceTreeNodes that should be filtered out. In working to get j and k hotkeys to ignore filtered nodes (see selectNextSibling and selectPreviousSibling in ResourceTreeNode.svelte) I attempted to filter out the children fro each node entirely.

In ResourceTreeNode.svelte each {#await childrenPromise} would be rewritten to:

{#await childrenPromise.then((children) => children.filter((child) => !searchFilter || searchFilter.includes(child.get_id())))}

In doing this I created an infinite loop due to svelte reactivity.

After investigation the reason for this is as follows:

How would you implement this fix? To fix this, resourceNodeDataMap should be populated separately from the GUI display, and be assumed to always contain the full data map of the resource. This means it should only update when the OFRAK Resource is modified or updated in some way.