     atom.project.resolve(atom.config.get("markdown-writer.siteLinkPath"))
 
   fetchPosts: ->
-    uri = atom.config.get("markdown-writer.urlForPosts")
-    succeed = (body) =>
-      @searchBox.show()
-      @posts = body.posts
-    error = (err) => @searchBox.hide()
-    utils.getJSON(uri, succeed, error)
+    if posts
+      @searchBox.show() if posts.length > 0
+    else
+      uri = atom.config.get("markdown-writer.urlForPosts")
+      succeed = (body) =>
+        posts = body.posts
+        @searchBox.show() if posts.length > 0
+      error = (err) =>
+        @searchBox.hide()
+      utils.getJSON(uri, succeed, error)

    @on "core:cancel", => @detach()

  handleEvents: ->
    @searchEditor.hiddenInput.on "keyup", => @updateSearch()
    @searchResult.on "click", "li", (e) => @useSearchResult(e)

  onConfirm: ->

      @setLink(selection, "", "")

  updateSearch: ->
    query = @searchEditor.getText().trim().toLowerCase()
    results = posts.filter (post) ->
      query and post.title.toLowerCase().contains(query)
    results = results.map (post) ->
      "<li data-url='#{post.url}'>#{post.title}</li>"
