mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-20 13:19:16 +00:00
[ASIndexedNodeContext] Do not cache the envTraitCollection, use the delegate to request it when needed (#2963)
Caching the envTraitCollection upon creation of `ASIndexedNodeContext` can lead to it becoming out of date. Ask the `id<ASEnvironment>` object for the trait collection when we need it.
This commit is contained in:
parent
d7670780b2
commit
39298f6694
@ -25,7 +25,6 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@property (nonatomic, readonly, copy, nullable) NSString *supplementaryElementKind;
|
||||
@property (nonatomic, readonly, assign) ASSizeRange constrainedSize;
|
||||
@property (weak, nonatomic) id<ASEnvironment> environment;
|
||||
@property (nonatomic, readonly, assign) ASEnvironmentTraitCollection environmentTraitCollection;
|
||||
|
||||
- (instancetype)initWithNodeBlock:(ASCellNodeBlock)nodeBlock
|
||||
indexPath:(NSIndexPath *)indexPath
|
||||
|
||||
@ -41,7 +41,6 @@
|
||||
_supplementaryElementKind = [supplementaryElementKind copy];
|
||||
_constrainedSize = constrainedSize;
|
||||
_environment = environment;
|
||||
_environmentTraitCollection = environment.environmentTraitCollection;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@ -59,7 +58,7 @@
|
||||
node.cachedIndexPath = _indexPath;
|
||||
node.supplementaryElementKind = _supplementaryElementKind;
|
||||
node.owningNode = (ASDisplayNode *)_environment;
|
||||
ASEnvironmentStatePropagateDown(node, _environmentTraitCollection);
|
||||
ASEnvironmentStatePropagateDown(node, [_environment environmentTraitCollection]);
|
||||
_node = node;
|
||||
}
|
||||
return _node;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user