statamic-rad-pack / runway

Eloquently manage your database models in Statamic.
https://statamic.com/addons/rad-pack/runway
MIT License
113 stars 49 forks source link

Page variable is null in blade component when using frontend routing #584

Closed vJoeyz closed 1 month ago

vJoeyz commented 2 months ago

Description

The $page variable is always null in templates using blade components when using the frontend routing feature of Runway. However, that page states all variables from the cascade are available.

Steps to reproduce

  1. Create a resource that uses the RunwayRoutes trait
  2. Set the template in the Runway config to a template that uses components inside it eg:~~
    <x-layout :context="$__data">
    Hello, world!
    </x-layout>
  3. Inside the layout component call:
    @props(['context'])
    {{ $page->id }}
  4. Error: Attempt to read property "id" on null

Environment

Environment Application Name: Test Laravel Version: 11.14.0 PHP Version: 8.3.8 Composer Version: 2.7.7 Environment: local Debug Mode: ENABLED URL: local.test Maintenance Mode: OFF Timezone: UTC Locale: en

Cache Config: NOT CACHED Events: NOT CACHED Routes: NOT CACHED Views: CACHED

Drivers Broadcasting: log Cache: file Database: sqlite Logs: stack / single Mail: log Queue: sync Session: file

Statamic Addons: 1 Sites: 3 (Nederlands, Deutsch, English) Stache Watcher: Enabled Static Caching: Disabled Version: 5.12.0 PRO

Statamic Addons statamic-rad-pack/runway: 7.7.5

duncanmcclean commented 1 month ago

I've got a fix ready which will allow you to use the $page variable, like you can with entries, however it depends on a PR in Statamic Core before it can be merged & released.

github-actions[bot] commented 1 month ago

Released as part of v7.9.1.