Skip to content

Leaf throws a fatal error when Content is passed in as context in render(name: ,context: ) #190

@YnotProgramInSwift

Description

@YnotProgramInSwift

Description:
Issue: Leaf throws a fatal error when Content is passed in as context in req.view.render(name: ,context: ) instead of a dictionary.

Reproduction

I am using Leaf 4.0.0.

I have saved a few Planet objects in my postgresSQL database using Fluent. Planet has a number of properties, including one called "name" (see Vapor Fluent documentation). I was attempting to make a database call using Fluent and display the output as a list on a website using Leaf.

This is my route:
Screen Shot 2020-11-16 at 10 16 43 pm

I passed in "planets" as context, which resulted in the following fatal error when I tried to access the route:

Screen Shot 2020-11-16 at 10 15 51 pm
Screen Shot 2020-11-16 at 10 16 02 pm

this issue was fixed when i passed ["planets":planets] as the context.

Expected Behavior

Blank page should be displayed, instead of throwing a fatal error.

Environment

  • Vapor Framework version: 4.0.0
  • Vapor Toolbox version: (unknown)
  • OS version: OSX 10.15.7

Additional context
Raising this as an issue as requested by 0xTim

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions