🏠 back to Observable

How to make all of my cells run?

Hi! This is my first time using Observable.
Everything is going really smoothly, except for one thing. There is one cell of code that doesn’t get run when I refresh the page, and I need it to run because the viewof depends on it. I have to manually run that one cell in order for everything to work. The specific line is below (the variable ‘list’ is a Set … that is why I am converting to a list).

sortedList= Array.from(list).sort()

What could be the reason that this cell is not being run?
Thanks so much!

Hi, welcome! It’s a bit hard to figure out exactly what’s going on without seeing the details of your notebook; if you “Enable link sharing” and paste a link here we might be able to give specific pointers.

In general, note that cells are only guaranteed to run after their dependencies have returned a value. Is the cell possibly running earlier than you expect? You’ve probably seen this tutorial, but pay attention to what it says about “topological order”:

You can check the dependency graph of your notebook by using this neat tool:

1 Like

Hi, thanks for your quick reply!
Can you view this?
for clarification, the line that is not running is sortedYearsSet = Array.from(yearsSet).sort()
And from the viewOf at the top, the set is empty, and thus cannot populate the dropdown list

Hi Yennie,

Sure thing - just sent you a suggestion. The idea is to avoid mutation of existing values, so I tweaked the sortedYearsSet cell to create the Set and populate it all in one.

1 Like

Hi Tom,
Thank you so much for your suggestion! That fixed the problem :slight_smile:
Now I know about mutation and about using the Notebook visualizer as well (which was a super helpful tool). I am still getting used to the syntax and how Observable runs.

I really appreciate your quick feedback!

Glad things got figured out! Just so future readers can follow, I don’t see a link in any of your posts, but after searching on the main site it looks like you were referring to this notebook: