Issues using .get() on a list of things

anyone have issues calling .get() on an array of things passed into a plugin?? would appreciate your time here if you’re experienced with plugin building

Can you take your function out of the variable declaration and just console log the function itself outside of the if statement? Use hard coded values without using length, so like this: (0, 1)

sure thing. i modded the code and ran it, then screen shot the output. you’ll see that it never hits the last 2 console logs :sob:

Screenshot 2024-04-01 at 8.38.38 PM

What’s interesting to me here is that the .get() does pull in the corresponding records according the network tab in the dev console.


I’ve stumbled upon a perplexing issue in my JavaScript code. I’ve recorded a detailed Loom video to accompany this post, showcasing the problem live. Here’s a breakdown of what’s happening:

  1. Initial Setup: I access the length property of a data object passed in via properties.submaps.length(), i then save save it globally under window.submaps. i then try to call .get() on window.submaps.
  2. Debugging Attempts: To diagnose, I log messages indicating the start of evaluation, the object itself, and its length. Suspecting a race condition, I introduce a setTimeout.
  3. Unexpected Behavior: Despite the logging showing as expected, attempting to retrieve data from window.submaps triggers an “uncaught object object” error.
  4. Isolation of Issue: Removing the problematic code snippet seemingly resolves the error, indicating it as the source of trouble.
  5. Reintroduction of Code: Reinserting the code reproduces the error, confirming its role in the issue.
  6. Confounding Data Access: Accessing data directly via window.submaps.get(0, 1) via the dev console on the same page paradoxically works, indicating the data exists and is accessible.
  7. Recurring Error: Despite the data’s accessibility, executing the same code elsewhere in the application throws a “not ready” error.

Context: This erratic behavior is baffling. The same code intermittently fails and succeeds in accessing the data, hinting at a deeper, perhaps asynchronous, issue.

I’m at my wit’s end trying to decipher what these symptoms could mean or how to resolve them. If anyone has encountered similar issues or has any suggestions, your input would be greatly appreciated. The video link attached should provide a clearer picture of the problem in action.

Thank you for your time and help!

Note: The video provides a live demonstration for better context and understanding of the issue described.

Looking forward to your insights and suggestions!

Try declaring the submaps at the beginning of the update function first.

So something like let submaps = properties.submaps

Hope that helps…

1 Like

Yes, declare the variable at the beginning and then reuse