8000 Custom action metadata via decorators · Issue #559 · xaviergonz/mobx-keystone · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Custom action metadata via decorators #559
Open
@exception-producer

Description

@exception-producer

Hi! First of all thank you for this amazing library, it really is a joy to work with.

We are currently running into a wall when trying to augment the model actions with additional metadata, for example permissions required to execute it. We initially tried simply attaching the metadata to the descriptor, but since mobx-keystone converts these properties to wrappedAction objects internally, this data is lost. We sadly were not able to work around this when experimenting. Since we also do not have access to the model type when setting the decorator, using an external mapping also failed.

We feel like being able to get additional action metadata during runtime would bring a great benefit to this library. All while keeping the clean structure that mobx-keystone provides by also leveraging decorators:

@modelAction
@requirePermissions(['edit'])
setFoo(bar) {
    ...
}

Is there something we may have missed on how to implement this behavior? Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0