Skip to content

New cache system #684

@michalkvasnicak

Description

@michalkvasnicak

By default visage should encourage developers to memoize styles prop so it'd be better to make styles prop immutable (uses ref to store the first reference to styles object and doesn't react to its changes). Also we can introduce a prop that says that the styles prop should be mutable ( default false ).

Also cache needs to be simplified, now the code is terrible. With babel plugin we can cache everything much easier because styles are hoisted (the ones that can be). With immutable styles prop it's little bit harder because we still need to serialize styles to know their hash quickly. Maybe we could leverage some cache id counter that can be used instead, so we don't need to check for equality of object.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions