Coder Social home page Coder Social logo

Comments (6)

KasparRosin avatar KasparRosin commented on August 22, 2024

Hey @matthewjumpsoffbuildings

I was unable to reproduce the issue with my nova. Could you provide more information/reproducible code example so we can take another look at this issue.

from nova-page-manager.

matthewjumpsoffbuildings avatar matthewjumpsoffbuildings commented on August 22, 2024

In one of my Templates, I had a static function regions() which simply called nova_get_regions() and returned that as an associative array. Then in my Field definitions I was trying to use some of the data from that (some colors set in a different region), to prefill the palette of a Color field.

from nova-page-manager.

KasparRosin avatar KasparRosin commented on August 22, 2024
$regions = nova_get_regions();
$titles = collect($regions)->pluck('data')->pluck('et.title')->filter();
 return [
     Select::make('Titles')->options($titles),
]

I tried to reproduce the issue with code above but was unable to.
Could be an issue with the colour field/invalid data.

Closing this at the moment since i can't find a reason how this could be regions/page-manager issue.

from nova-page-manager.

matthewjumpsoffbuildings avatar matthewjumpsoffbuildings commented on August 22, 2024

It didn't matter if I actually implemented the retrieved values into the Color Field (or any other field). The mere presence of the nova_get_regions() in my Template was enough to crash the app.

I was actually caching the response of nova_get_regions() using Laravels Cache helper? Could that be the source of the issue?

Heres a rough example

class AppController extends Controller
{
	public static function regions()
	{
		return Cache::remember('regions', 60, function(){
			return nova_get_regions();
		});
	}

My Template

class Shortlist extends Template
{
	public static $type = 'region';
	public static $name = 'Shortlist';

	public function fields(Request $request): array
	{
		$regions = AppController::regions();
		return [ ...

Even if I do nothing with $regions, just having the call to nova_get_regions() in the static function in AppController is enough to break it

from nova-page-manager.

KasparRosin avatar KasparRosin commented on August 22, 2024

My bad, this seems to be the problem indeed when calling nova_get_regions inside region template.
I was testing this inside a page template, which was the reason why i wasn't able to reproduce.

from nova-page-manager.

matthewjumpsoffbuildings avatar matthewjumpsoffbuildings commented on August 22, 2024

No worries. Right now Im getting around it by just using the Region::all() method to get all the regions data, that doesn't crash anything, though the data is formatted a bit differently than it would be from nova_get_regions()

from nova-page-manager.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.