I have come across another issue in version 2.0.0...
# arrow
c
I have come across another issue in version 2.0.0-alpha.2
Screenshot 2024-05-28 at 06.09.04.png
Screenshot 2024-05-28 at 06.09.40.png
s
Is
TextFieldState
annotated with
@optics
as well?
c
yes
s
Okay, seems we have some testing to do on the KSP plugin
c
in 1.2.4 version i have a generated field called nullableValue, in version 2.0.0 it has disappeared
s
What was
nullableValue
doing? We're cleaning up the DSL for Optics a bit.
We're now generating
Lens<Source, Focus?>
for nullable types, such that you can erase its value.
nonNull
is just to turn it into
Optional<Source, Focus>
c
an example
this his the current
and maybe we need something like this, with the "?"
s
We do have something like
?
which is
notNull
and takes you from
Lens<S, A?>
to
Optional<S, A>
. Not sure why that second screenshot is red underlined though. Guess we need to add some failing tests for these casees.
a
this is one of the breaking changes in 2.0 -- fields of type
T?
now generate
Lens<A, T?>
instead of
Optional<A, T>
, so you can set them back to non-nullable as Simon mentioned, the fix is to use
notNull
, which turns
Lens<A, T?>
into
Optional<A, T>
, if you need the 1.2.x behavior
c
Oh, I understand now. With this information, I can make it work like in previous versions. Thanks!
Copy code
CourseState.level.notNull.name() set  level.value.toString()

//setter
CourseState.level.setNullable(state , null)
🙌 1