invoiceninja/ui

Expense categories not available in drop down list after update

Closed this issue · 14 comments

Setup

  • Version: Latest
  • Environment: Docker

Interface

  • React: []

Describe the bug

This occurred right after updating to latest rev. When entering an expense, the drop down menu for expense category is only showing one of several categories. In the settings under expense defaults, my categories still remain but upon creating an expense, only one is shown from my list. It happens to be one in the middle so not the first or last or alphabetical.

Steps To Reproduce

After update, creating any expense.

Expected Behavior

Show ALL expense categories.

Additional context

I tested this on the demo site although I had to create NEW expense categories as none existed. The problem was not observed but I assume that the stock demo didn't have any existing categories when it was updated to latest rev.

Screenshots

1 of 8 categories shown
image

Additional note: This does not seem to be an issue in the Flutter GUI.

I cannot recreate this issue.

I've tried clearing browser cache, restarting the container, not sure what else to try. I had to enter some expenses in the flutter gui.

I'm open to suggestions, this wasn't an issue prior to latest build. Let me know what I can do to help.

I cannot recreate this issue.

So admittedly I failed myself here by updating my "production" instance before my "test"/backup instance. Anyway...My test instance is behind a few updates but may at least give insight into the window where/when this issue started. As you can see in the screen shot, my test instance is showing the full list of expense categories while my "prod" on the latest version is only showing the one category. I keep my test instance as a mirror to prod using same cofig/database/flat files Only difference currently is the container/app version. In the screen shot I had to switch to Flutter to get the ver info. I typically use React GUI but do not find ver information easily available in that interface.

Edit: light/dark mode does not change issue in current ver.

IN_expensecat

try having your browser console opern when loading the app, and see if the app is reaching /api/v1/expense_categories

you'll get more information there i think.

I tried to look through the console while opening IN and entering some expenses today... I probably just don't know where to look exactly but I couldn't find /api/v1/expense_categories in either of my instances. I did however come to the realization that while only one of 8 categories is shown in the drop down menu...I can still start typing out any of the other categories and can then select that category. I don't know if that tidbit helps. With only 8 categories I guess not a big deal to do this for now.

I also noticed that my preference setting to dark mode does not save after closing the browser (chrome). For giggles, I wondered if my browser is doing something weird and I logged in to IN with MS Edge and still had the same expense category issue of not showing all the categories in the drop down menu.

image

I did see these errors in the console:
IN_console_errors1

IN_console_errors2

We're also seeing similar behavior, although I don't have any error output in my console. Using the flatpak of Firefox 124.0.1 (64-bit) on Ubuntu 23.10.

We have 11 expense categories defined, but only one will show in the dropdown at a time. It seems kind of arbitrary which one shows up, but there's probably some pattern that I haven't deciphered yet.

Looking in the network tab of the inspector, I can see that (at least) two API requests to the expense_categories endpoint appear to have been completed, both with a 200 response. The latter request (shown in my screenshot) is filtered to only get the category assigned to the expense being edited, but the earlier request (two above the highlighted one in my screenshot) doesn't have the same filter, but it does limit itself to 1 item per page. (the URL path is /api/v1/expense_categories?status=active&per_page=1&sort=name|asc&filter=, with no filter value) Maybe there's something not requesting the rest of the pages?

expense-categories

If you type ahead does the system perform another API request with your filter?
1

If you type ahead does the system perform another API request with your filter? 1

I can now answer this with a yes. Entering a couple expenses just now with the console open on the network tab and when I start typing to bring up any other category than the single one shown...another call is made. If there is a screen shot or something I can take to be more useful, please let me know.

@TekWarren and when you do type ahead, do the categories appear for selection for you?

@TekWarren and when you do type ahead, do the categories appear for selection for you?

Only the category that matches with what I am typing appears and no others (not even the single one that appears with no text input). If I start typing "job" for job supplies only that one appears as a selection.

Wanted to add... I checked my test/back up instance yesterday confirming previous ver did not have this issue. I then updated and the issue is now present. These are two different docker environments: unraid and docker desktop for windows.

@TekWarren

I've checked on my Docker instance, and can confirm I see the issue there. We'll tag a new release with a fix.