statamic-rad-pack / runway

Eloquently manage your database models in Statamic.
https://statamic.com/runway
MIT License
107 stars 43 forks source link

User column view preferences interfere with Runway finding custom primaryKey #456

Closed jmalko closed 3 months ago

jmalko commented 4 months ago

Description

I upgraded a site locally with a new $primaryKey in a model (and all the other changes to facilitate). image

I added the 'title_field' to the config as documented. image

And everything just worked in local. On production however, I would get this error when visiting the main /cp route for the model: StatamicRadPack\Runway\Http\Controllers\CP\ResourceController::getPrimaryColumn(): Return value must be of type string, null returned

After troubleshooting on Discord, removing or invalidating runway preferences on my user fixed the issue: image

Users are in the database here, which is why local changes to my preferences did not carry over - and why a fresh install of the site would also make it work.

Steps to reproduce

Create a model and add it to runway with some columns. Save visibility/order of columns to display. Change the model to use a different $primaryKey and adjust title_field on config/runway.php Visit the runway model page.

Environment

image

duncanmcclean commented 3 months ago

The first column in your preferences is store_number_complete. What does the YAML for that field look like?

jmalko commented 3 months ago

Doesn't exist anymore either in the data or blueprint.

duncanmcclean commented 3 months ago

Ah, that'll have been it then. If you were to remove / replace it with a field that does exist in your blueprint, then it'll work.

I'll keep this open since non-existent fields can probably be filtered out to prevent it from erroring.

duncanmcclean commented 3 months ago

Oddly enough, I can't seem to reproduce this anymore. I'll close this without a fix.