Skip to content

save channels to private data#296

Merged
AtlantisPleb merged 19 commits into
mainfrom
savechan
Jul 7, 2023
Merged

save channels to private data#296
AtlantisPleb merged 19 commits into
mainfrom
savechan

Conversation

@earonesty

Copy link
Copy Markdown
Contributor

save channels to private data and load at signin, so channel list doesn't change if you sign out/in

@reyamir

reyamir commented Jul 7, 2023

Copy link
Copy Markdown
Contributor

I've found error, this function won't work, because in login screen, we not init relay yet

export function useChannelManager() {
  const pool = useContext(RelayContext) as PoolWithChannels
  if (!pool.__channels) {
    pool.__channels = new ChannelManager(pool)
  }
  const mgr = pool.__channels
  return mgr
}

in RelayProvider, I make relay only init when ident has present

const pool = useMemo(() => (ident ? new NostrPool(ident, db) : null), [privkey])

so in login screen, we not have ident (user not login) then relay will not work at this step

@reyamir

reyamir commented Jul 7, 2023

Copy link
Copy Markdown
Contributor

I wonder that can we make NostrPool not require ident in first place new NostrPool(ident, db), but can update ident it later, example: login/signup -> add indent to NostrPool

@earonesty

Copy link
Copy Markdown
Contributor Author

yes thats fine. a pool only needs relays unless you're posting messages

@AtlantisPleb AtlantisPleb merged commit d750d35 into main Jul 7, 2023
@AtlantisPleb AtlantisPleb deleted the savechan branch July 7, 2023 16:12
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.

3 participants