Critical Error - can't find problem

I am getting a critical error now on the live test on mobile, when before it was working without issue. When I click the button, instead of it completing the action, I get the error screen. On the web, it works just fine.

The error showed after I added blocks to the screen for another component. I removed them, and the error persists.

Attached are screenshots of the blocks in question, which I have not changed from when they were working.

Can someone help me figure out how to fix this please?

Screen Shot 2023-06-06 at 2.26.53 PM

Just a side note that you don’t have to check app variables for null values. That’s only something you need to do for stored variables. You could probably simplify that code quite a bit…

But in terms of finding the source of the crash, I’d recommend doing some block-by-block debugging. I have a method I use that works pretty well: Debugging in Thunkable X (Video)

As for the “null”, I found it during my searches on the site and it worked, so I used it. Lol. What would you suggest to do to simplify it? I’m all for less coding to mess up.

I’ll take a look at the debugging info now, thanks :slight_smile:

Sure, I can suggest some improvements. If possible, post a link to your project so I can modify your blocks to show you.

Also, what is the purpose of that code? Are you trying to swap background colors?

I’m not sure how to share my project, as it’s private - I’ll try a link. Thunkable

Yes, it’s a drop down list, and the selected item changes colour and gets pushed to the button’s text.

I’m not able to open that, possible because it’s a private project.

But one change I would make is that when the user clicks an item, you just set the Layout Wrapper’s Background Color to a color value (either via a variable or the Layout Wrapper’s Background Color block).

You can probably do that without variables and definitely without “if” blocks.

1 Like

I went through the blocks and reduced what was there by getting rid of variables, etc. It works as intended, but there is one new issue. When you click the item in the list, it changes colour, and sends the text to the button. If you click the button again, it now returns the list and the first item is still highlighted, and it will highlight the next button you click as well. I want only one to be able to be highlighted at a time.

As for the mobile app, I am still getting the critical error message with these new changes. I have attached a SS of the revamped blocks.

That looks much better!

You’re going to need to loop through all of the rows and set the background color based on whether or not the row is matches the one the user clicked. It’s not the easiest thing to set up and it requires using the Any Component blocks.

I’ll see if I can find an example for you on the forums.

Edit: this is a good example that you can tweak for your needs: Cloud based To Do list, part 1

1 Like

I was able to get the button to work properly by adding a few blocks at the end, but I didn’t use the Any Component blocks. Would this cause problems? Would you mind taking a look at it? The first button works as expected, but the 2nd button, same type of blocks, does not change colour and change the text of the button.

I am still stuck on the critical error on mobile. Removing the extra blocks had no effect like I had hoped.

I’m off to check out the Cloud example you posted. Thank you :slight_smile:
(EDIT: the Cloud example link has expired)

I didn’t check the link in that topic but the screenshots should be helpful.

If you made changes to your project, you’ll need to post a new link. Each link is a snapshot of the state of that project at the time the link was created.

1 Like

I did read through the page and screenshots, just thought I’d give a heads-up on the link.

I made a copy of the private project page that has the critical error issue on mobile. I don’t have all the components on this screen yet, but it does give the error message when the Strain or Product buttons are pressed. The Product button is the one that isn’t working properly yet (colour change and text push)
https://x.thunkable.com/projects/6482218b8e8991da8f8e487d/85bf2d28-3119-467d-b39d-075797f28730/designer

It’s not crashing for me on an iPhone. What device are you using? And at what point does it crash?

I’m using a Pixel 5. The app and the screen open fine. I can click anything except the Strain or Product buttons. Click either of those, and it gives the critical error.

EDIT: I have cleared the app’s cache, and restarted my phone, in an attempt to get it to work.
I have attached a screenshot of the error I get when I click the Strain button.

EDIT: I tested on a Galaxy S8+ and same result. Boo.

Hmm. I think that’s going to be something you need Thunkable Staff support for.

I made a copy of the private app so that I can post it for your review. It works fine on web, crashes on my mobile (Pixel 5 and Samsung Galaxy S8+).

The screen in question is the NEW_STRAIN_PAGE. The STRAIN and PRODUCT buttons are the buttons that create the critical error message on mobile.

I have the blocks set up for most of the page, but am hung up on trying to make sure that the app works so far on web and mobile. I am hopeful that you can help me figure out where I went wrong. Thunkable

Hello @kcmahlo
I checked your app
It seems the issue is related to the custom Data viewer layout you are using on the DVLs
I used another Layout and everything worked fine.
Try to do the same and let me know if it helped

1 Like

I’m not sure what you mean by Layout for the DVL. I ended up switching to a Simple List, and it works now. Did you mean something different?

Thank you @ioannis for taking the time to look over my project to help find where it went buggy. :slight_smile:

@kcmahlo Glad that it is working for you now
This is the Data viewer layout:
image

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.