Skip to content

Keep builder state when a property is None#11

Open
pojntfx wants to merge 1 commit into
p2panda:mainfrom
pojntfx:fix-builder
Open

Keep builder state when a property is None#11
pojntfx wants to merge 1 commit into
p2panda:mainfrom
pojntfx:fix-builder

Conversation

@pojntfx

@pojntfx pojntfx commented Apr 21, 2026

Copy link
Copy Markdown

With the current state on main, if you pass in a property as None, the whole builder gets overwritten. This PR changes that so in the case where a property is None, we just return the builder unchanged.

This fixes connecting to a bootstrap node - with the state on main, if you disable mDNS and connect via a bootstrap node, nothing ever connects otherwise since every None argument would wipe all preceding arguments, e.g. the bootstrap URL.

Heads up: My Rust is very rusty, so there might be a better way to do this I'm not aware of?

Signed-off-by: Felicitas Pojtinger <felicitas@pojtinger.com>
@adzialocha adzialocha self-requested a review May 5, 2026 09:47

@adzialocha adzialocha left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not a glib expert but I think this looks good!

From a Rust perspective you could do an early return for value right at the beginning before you go into the match statement, something like that:

let Some(value) = value else {
    return builder
};

Now you can assume that value will always be Some for all code coming after.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants